linux/drivers/staging/wlan-ng
Kees Cook 86a0727b09 staging: wlan-ng: Avoid duplicate header in tx/rx frames
Instead of open-coding the same header details in the tx/rx frames,
directly include the actual struct. Rename associated variables to the
more verbose of the two versions. This also has the benefit of being
able to replace a field-spanning memcpy() with a direct assignment,
helping clear the way for coming FORTIFY_SOURCE improvements.

"diffoscope" reports no object code differences after this change,
excepting the selection of different registers when switching from
memcpy() to direct assignment:

 --- drivers/staging/wlan-ng/prism2usb.o.before
 +++ drivers/staging/wlan-ng/prism2usb.o.after
├── objdump --line-numbers --disassemble --demangle --reloc --no-show-raw-insn --section=.text {}
│ @@ -4887,24 +4887,24 @@
│       sub    %rdi,%rcx
│       add    $0x3c,%ecx
│       shr    $0x3,%ecx
│       rep stos %rax,%es:(%rdi)
│       mov    $0x8,%eax
│       movl   $0x123,0x23e(%rbx)
│       mov    %ax,0x244(%rbx)
│ -     mov    (%rdx),%rcx
│ -     mov    %rcx,0x246(%rbx)
│ -     mov    0x8(%rdx),%rcx
│ -     mov    %rcx,0x24e(%rbx)
│ -     mov    0x10(%rdx),%rcx
│ -     mov    %rcx,0x256(%rbx)
│ -     mov    0x18(%rdx),%ecx
│ -     mov    %ecx,0x25e(%rbx)
│ -     movzwl 0x1c(%rdx),%edx
│ -     mov    %dx,0x262(%rbx)
│ +     mov    (%rdx),%rax
│ +     mov    %rax,0x246(%rbx)
│ +     mov    0x8(%rdx),%rax
│ +     mov    %rax,0x24e(%rbx)
│ +     mov    0x10(%rdx),%rax
│ +     mov    %rax,0x256(%rbx)
│ +     mov    0x18(%rdx),%eax
│ +     mov    %eax,0x25e(%rbx)
│ +     movzwl 0x1c(%rdx),%eax
│ +     mov    %ax,0x262(%rbx)
│       cmpq   $0x0,0x0(%rbp)
│       movzwl 0x70(%rsi),%eax
│       je     477a <hfa384x_drvr_txframe+0xba>
│       add    $0x8,%eax
│       mov    $0x44,%r12d
│       mov    %ax,0x264(%rbx)
│       mov    0x70(%r13),%edx

Cc: Romain Perier <romain.perier@gmail.com>
Cc: Allen Pais <apais@linux.microsoft.com>
Cc: Ivan Safonov <insafonov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-staging@lists.linux.dev
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210819174537.3499227-3-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-26 10:41:16 +02:00
..
cfg80211.c staging: wlan-ng: cfg80211: Move large struct onto the heap 2021-05-10 11:19:23 +02:00
hfa384x_usb.c staging: wlan-ng: Avoid duplicate header in tx/rx frames 2021-08-26 10:41:16 +02:00
hfa384x.h staging: wlan-ng: Avoid duplicate header in tx/rx frames 2021-08-26 10:41:16 +02:00
Kconfig staging/wlan-ng: add CRC32 dependency in Kconfig 2019-12-10 10:56:54 +01:00
Makefile
p80211conv.c staging: wlan-ng: Avoid duplicate header in tx/rx frames 2021-08-26 10:41:16 +02:00
p80211conv.h staging: wlan-ng: Remove pointless a3/a4 union 2021-08-26 10:41:16 +02:00
p80211hdr.h staging: wlan-ng: Avoid duplicate header in tx/rx frames 2021-08-26 10:41:16 +02:00
p80211ioctl.h staging: wlan-ng: silence incorrect type in argument 1 (different address spaces) 2021-05-10 11:19:33 +02:00
p80211metadef.h
p80211metastruct.h
p80211mgmt.h staging: wlan-ng: Remove pointless a3/a4 union 2021-08-26 10:41:16 +02:00
p80211msg.h
p80211netdev.c staging: wlan-ng: Avoid duplicate header in tx/rx frames 2021-08-26 10:41:16 +02:00
p80211netdev.h staging: wlan-ng: Remove pointless a3/a4 union 2021-08-26 10:41:16 +02:00
p80211req.c
p80211req.h
p80211types.h staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
p80211wep.c staging: wlan-ng: p80211wep.c: use lib/crc32 2019-10-07 12:32:43 +02:00
prism2fw.c staging/wlan-ng: Remove all strcpy() uses in favor of strscpy() 2021-07-27 15:11:10 +02:00
prism2mgmt.c staging/wlan-ng: Fix line alignment 2020-11-06 10:57:46 +01:00
prism2mgmt.h
prism2mib.c staging: wlan-ng: Disable buggy MIB ioctl 2021-08-18 12:45:28 +02:00
prism2sta.c staging: wlan-ng: Avoid duplicate header in tx/rx frames 2021-08-26 10:41:16 +02:00
prism2usb.c staging: wlan-ng: fix out of bounds read in prism2sta_probe_usb() 2020-08-18 16:12:54 +02:00
README

TODO:
	- checkpatch.pl cleanups
	- sparse warnings
	- move to use the in-kernel wireless stack

Please send any patches or complaints about this driver to Greg
Kroah-Hartman <greg@kroah.com> and don't bother the upstream wireless
kernel developers about it, they want nothing to do with it.