]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: sm_ftl: fix NULL pointer warning
authorArnd Bergmann <arnd@arndb.de>
Tue, 7 Jan 2020 21:24:52 +0000 (22:24 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 9 Jan 2020 19:09:55 +0000 (20:09 +0100)
commit6c74daa6168a07cc8fcb9a4120c02ad9808cab19
treec3ba0932b7b949f3aa724850774a9ea599fb816f
parent0b6550d684a4073908a3af5988690c3ba1996dea
mtd: sm_ftl: fix NULL pointer warning

With gcc -O3, we get a new warning:

In file included from arch/arm64/include/asm/processor.h:28,
                 from drivers/mtd/sm_ftl.c:8:
In function 'memset',
    inlined from 'sm_read_sector.constprop' at drivers/mtd/sm_ftl.c:250:3:
include/linux/string.h:411:9: error: argument 1 null where non-null expected [-Werror=nonnull]
  return __builtin_memset(p, c, size);

>From all I can tell, this cannot happen (the function is called
either with a NULL buffer or with a -1 block number but not both),
but adding a check makes it more robust and avoids the warning.

Fixes: mmtom ("init/Kconfig: enable -O3 for all arches")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/sm_ftl.c