lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f17a1851-7360-3f18-4e89-dbf6948eeaff@huawei.com>
Date: Thu, 13 Mar 2025 21:09:09 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	<linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
CC: Miquel Raynal <miquel.raynal@...tlin.com>, Richard Weinberger
	<richard@....at>, Vignesh Raghavendra <vigneshr@...com>
Subject: Re: [PATCH v2 1/1] mtd: mtdpart: Do not supply NULL to printf()

在 2025/3/13 17:15, Andy Shevchenko 写道:
> GCC compiler is not happy about NULL being supplied as printf() parameter:
> 
> drivers/mtd/mtdpart.c:693:34: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
> 
> Move the code after the parser test for NULL, and drop the ternary completely.
> The user can deduct this since when it's not NULL two messages will be printed.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> 
> v2: changed approach to remove that ternary completely, seems less hackish
> 
>   drivers/mtd/mtdpart.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Zhihao Cheng <chengzhihao1@...wei.com>
> 
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 6811a714349d..994e8c51e674 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -690,10 +690,9 @@ int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
>   			parser = mtd_part_parser_get(*types);
>   			if (!parser && !request_module("%s", *types))
>   				parser = mtd_part_parser_get(*types);
> -			pr_debug("%s: got parser %s\n", master->name,
> -				parser ? parser->name : NULL);
>   			if (!parser)
>   				continue;
> +			pr_debug("%s: got parser %s\n", master->name, parser->name);
>   			ret = mtd_part_do_parse(parser, master, &pparts, data);
>   			if (ret <= 0)
>   				mtd_part_parser_put(parser);
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ