]> www.infradead.org Git - users/jedix/linux-maple.git/commit
staging: rtl8712: remove unnecessary alignment of pxmitpriv->pxmitbuf
authorNam Cao <namcao@linutronix.de>
Sat, 25 May 2024 07:32:29 +0000 (09:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Jun 2024 11:35:01 +0000 (13:35 +0200)
commit9ed3e0a0e1b1e1336f3b3979aa478e1f5312da4d
tree1a5178f16d4d1b2099c9182a74356754b8e39ce1
parent8bcb9afc5de366d7c3e572582ff0da8b155e7e01
staging: rtl8712: remove unnecessary alignment of pxmitpriv->pxmitbuf

This driver wants pxmitpriv->pxmitbuf to be 4-byte aligned. This is ensured
by allocating 4 more bytes than required with kmalloc(), then do the
p = p + 4 - (p & 3) trick to make sure the pointer is 4-byte aligned.

This is unnecessary. Pointers from kmalloc() are already at least
8-byte-aligned.

Remove this alignment trick to simplify the code, and also to stop wasting
4 extra bytes of dynamic memory allocator.

This also gets rid of a (false) warning from kmemleak. This 4-byte-aligned
buffer is used to store pointers from kmalloc(). For 64-bit platforms,
pointer size is 8 bytes and kmemleak only scans for pointers in 8-byte
blocks, thus it misses the pointers stored in this 4-byte-aligned buffer
and thinks that these pointers have been leaked. This is just a false
warning, not a real problem. But still, it would be nice to get rid of
these warnings.

Reported-and-tested-by: syzbot+83763e624cfec6b462cb@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-staging/000000000000809328060a8a4c1c@google.com
Signed-off-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20240525073229.4144612-1-namcao@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/rtl871x_xmit.c
drivers/staging/rtl8712/rtl871x_xmit.h