WSL2-Linux-Kernel/drivers/staging/rts5208
Kees Cook cbe34165cc staging: rts5208: Fix get_ms_information() heap buffer size
Fix buf allocation size (it needs to be 2 bytes larger). Found when
__alloc_size() annotations were added to kmalloc() interfaces.

In file included from ./include/linux/string.h:253,
                 from ./include/linux/bitmap.h:10,
                 from ./include/linux/cpumask.h:12,
                 from ./arch/x86/include/asm/paravirt.h:17,
                 from ./arch/x86/include/asm/irqflags.h:63,
                 from ./include/linux/irqflags.h:16,
                 from ./include/linux/rcupdate.h:26,
                 from ./include/linux/rculist.h:11,
                 from ./include/linux/pid.h:5,
                 from ./include/linux/sched.h:14,
                 from ./include/linux/blkdev.h:5,
                 from drivers/staging/rts5208/rtsx_scsi.c:12:
In function 'get_ms_information',
    inlined from 'ms_sp_cmnd' at drivers/staging/rts5208/rtsx_scsi.c:2877:12,
    inlined from 'rtsx_scsi_handler' at drivers/staging/rts5208/rtsx_scsi.c:3247:12:
./include/linux/fortify-string.h:54:29: warning: '__builtin_memcpy' forming offset [106, 107] is out
 of the bounds [0, 106] [-Warray-bounds]
   54 | #define __underlying_memcpy __builtin_memcpy
      |                             ^
./include/linux/fortify-string.h:417:2: note: in expansion of macro '__underlying_memcpy'
  417 |  __underlying_##op(p, q, __fortify_size);   \
      |  ^~~~~~~~~~~~~
./include/linux/fortify-string.h:463:26: note: in expansion of macro '__fortify_memcpy_chk'
  463 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,   \
      |                          ^~~~~~~~~~~~~~~~~~~~
drivers/staging/rts5208/rtsx_scsi.c:2851:3: note: in expansion of macro 'memcpy'
 2851 |   memcpy(buf + i, ms_card->raw_sys_info, 96);
      |   ^~~~~~

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210818044252.1533634-1-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-18 10:10:49 +02:00
..
Kconfig staging: add missing SPDX lines to Kconfig files 2019-04-03 11:10:15 +02:00
Makefile staging: rts5208: remove unneeded header include path 2020-01-10 10:58:30 +01:00
TODO staging: Add missing newline at end of file 2019-06-18 08:59:40 +02:00
general.c Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
general.h Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
ms.c staging: rts5208: remove redundant continue statement 2021-06-18 13:02:47 +02:00
ms.h staging: rts5208: Eliminate the use of Camel Case in files ms.{h, c} 2019-11-01 10:53:16 +01:00
rtsx.c staging: rts5208: rtsx: Replace depracated MSI API 2020-07-21 16:52:47 +02:00
rtsx.h Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
rtsx_card.c Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
rtsx_card.h Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
rtsx_chip.c staging: rts5208: Assign array_size() to a variable 2020-07-13 15:36:31 +02:00
rtsx_chip.h staging: rts5208: correction in spelling 2019-03-24 10:06:36 +01:00
rtsx_scsi.c staging: rts5208: Fix get_ms_information() heap buffer size 2021-08-18 10:10:49 +02:00
rtsx_scsi.h Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
rtsx_sys.h Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
rtsx_transport.c staging: rts5208: rtsx_transport.c: Fix lines ending with parentheses 2020-09-13 09:20:31 +02:00
rtsx_transport.h Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
sd.c staging: rts5208: remove redundant sd30_mode checks 2019-09-03 09:36:07 +02:00
sd.h staging: rts5208: Eliminate the use of Camel Case in file sd.h 2019-11-01 10:55:10 +01:00
spi.c Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
spi.h Staging: rts5208: Add SPDX license tags 2018-11-05 14:16:33 +01:00
xd.c staging: rts5208: remove unnecessary ftrace-like logging 2021-04-12 11:40:13 +02:00
xd.h staging: rts5208: Eliminate the use of Camel Case in files xd.{h, c} 2019-11-01 10:55:09 +01:00