Skip to content

Commit de182cc

Browse files
arndbtorvalds
authored andcommitted
drivers/memstick/core/memstick.c: avoid -Wnonnull warning
gcc-7 produces a harmless false-postive warning about a possible NULL pointer access: drivers/memstick/core/memstick.c: In function 'h_memstick_read_dev_id': drivers/memstick/core/memstick.c:309:3: error: argument 2 null where non-null expected [-Werror=nonnull] memcpy(mrq->data, buf, mrq->data_len); This can't happen because the caller sets the command to 'MS_TPC_READ_REG', which causes the data direction to be 'READ' and the NULL pointer not accessed. As a simple workaround for the warning, we can pass a pointer to the data that we actually want to read into. This is not needed here, but also harmless, and lets the compiler know that the access is ok. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]> Cc: Alex Dubov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent b94f511 commit de182cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/memstick/core/memstick.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static int h_memstick_read_dev_id(struct memstick_dev *card,
330330
struct ms_id_register id_reg;
331331

332332
if (!(*mrq)) {
333-
memstick_init_req(&card->current_mrq, MS_TPC_READ_REG, NULL,
333+
memstick_init_req(&card->current_mrq, MS_TPC_READ_REG, &id_reg,
334334
sizeof(struct ms_id_register));
335335
*mrq = &card->current_mrq;
336336
return 0;

0 commit comments

Comments
 (0)