public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mirsad Todorovac <mtodorovac69@gmail.com>
To: "Rafał Miłecki" <rafal@milecki.pl>, linux-mtd@lists.infradead.org
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-kernel@vger.kernel.org,
	Miquel Raynal <miquel.raynal@bootlin.com>
Subject: Re: [PROBLEM linux-next] drivers/mtd/mtdpart.c:693:34: error: ‘%s’ directive argument is null
Date: Sun, 7 Jul 2024 15:05:59 +0200	[thread overview]
Message-ID: <d58cee6a-156a-4d3c-b80e-a35bd27b4223@gmail.com> (raw)
In-Reply-To: <0c095098-4b3e-481b-b866-29cacb9f165d@milecki.pl>

Hi, Rafał, others,

On 7/7/24 09:37, Rafał Miłecki wrote:
> Some more descriptive subject would be nice :)

I could have sworn I put it there, I wasn't intoxicated :-P

> On 7.07.2024 02:10, Mirsad Todorovac wrote:
>> In file included from ./include/asm-generic/bug.h:22,
>>                   from ./arch/x86/include/asm/bug.h:87,
>>                   from ./include/linux/bug.h:5,
>>                   from ./include/linux/fortify-string.h:6,
>>                   from ./include/linux/string.h:374,
>>                   from ./arch/x86/include/asm/page_32.h:18,
>>                   from ./arch/x86/include/asm/page.h:14,
>>                   from ./arch/x86/include/asm/processor.h:20,
>>                   from ./arch/x86/include/asm/timex.h:5,
>>                   from ./include/linux/timex.h:67,
>>                   from ./include/linux/time32.h:13,
>>                   from ./include/linux/time.h:60,
>>                   from ./include/linux/stat.h:19,
>>                   from ./include/linux/module.h:13,
>>                   from drivers/mtd/mtdpart.c:10:
>> drivers/mtd/mtdpart.c: In function ‘parse_mtd_partitions’:
>> drivers/mtd/mtdpart.c:693:34: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
>>    693 |                         pr_debug("%s: got parser %s\n", master->name,
>>        |                                  ^~~~~~~~~~~~~~~~~~~~~
>> ./include/linux/printk.h:376:21: note: in definition of macro ‘pr_fmt’
>>    376 | #define pr_fmt(fmt) fmt
>>        |                     ^~~
>> ./include/linux/dynamic_debug.h:248:9: note: in expansion of macro ‘__dynamic_func_call_cls’
>>    248 |         __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
>>        |         ^~~~~~~~~~~~~~~~~~~~~~~
>> ./include/linux/dynamic_debug.h:250:9: note: in expansion of macro ‘_dynamic_func_call_cls’
>>    250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
>>        |         ^~~~~~~~~~~~~~~~~~~~~~
>> ./include/linux/dynamic_debug.h:269:9: note: in expansion of macro ‘_dynamic_func_call’
>>    269 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
>>        |         ^~~~~~~~~~~~~~~~~~
>> ./include/linux/printk.h:610:9: note: in expansion of macro ‘dynamic_pr_debug’
>>    610 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
>>        |         ^~~~~~~~~~~~~~~~
>> drivers/mtd/mtdpart.c:693:25: note: in expansion of macro ‘pr_debug’
>>    693 |                         pr_debug("%s: got parser %s\n", master->name,
>>        |                         ^~~~~~~~
>> drivers/mtd/mtdpart.c:693:50: note: format string is defined here
>>    693 |                         pr_debug("%s: got parser %s\n", master->name,
>>        |                                                  ^~
>>
>> Offending commit is 5b644aa012f67.
> 
> Actually it goes back to 2015 to the commit 8e2c992b59fc ("mtd: mtdpart: add debug prints to partition parser.").

This is also correct.

>> Proposed non-intrusive fix resolves the warning/error, but I could not test the code.
>> (I don't have the physical device.)
>>
>> -----------------><------------------------------------------
>> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
>> index 6811a714349d..81665d67ed2d 100644
>> --- a/drivers/mtd/mtdpart.c
>> +++ b/drivers/mtd/mtdpart.c
>> @@ -691,7 +691,7 @@ int parse_mtd_partitions(struct mtd_info *master, const char *const *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);
>> +                               parser ? parser->name : "(null"));
>>                          if (!parser)
>>                                  continue;
>>                          ret = mtd_part_do_parse(parser, master, &pparts, data);
>>
>>
>> Hope this helps.
> 
> I'd say it's simple enough to send patch without actual hw testing.

Actually, it isn't simple enough to prevent a typo.

Here is the v2.

Do I have your Reviewed-by: or Acked-by: ?

Andy from Intel said that it has to be given explicitly.

------------------------------><-------------------------------------
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 6811a714349d..6f7e250ef710 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -691,7 +691,7 @@ int parse_mtd_partitions(struct mtd_info *master, const char *const *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);
+                               parser ? parser->name : "(null)");
                        if (!parser)
                                continue;
                        ret = mtd_part_do_parse(parser, master, &pparts, data);

--

Best regards,
Mirsad Todorovac

      parent reply	other threads:[~2024-07-07 13:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-07  0:10 [PROBLEM linux-next] Mirsad Todorovac
2024-07-07  7:37 ` Rafał Miłecki
2024-07-07  8:12   ` Jonas Gorski
2024-07-07 14:09     ` Mirsad Todorovac
2024-07-07 14:45       ` Mirsad Todorovac
2024-07-07 14:53       ` [PROBLEM linux-next] drivers/mtd/mtdpart.c:693:34: error: ‘%s’ directive argument is null Mirsad Todorovac
2024-07-07 13:05   ` Mirsad Todorovac [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d58cee6a-156a-4d3c-b80e-a35bd27b4223@gmail.com \
    --to=mtodorovac69@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=rafal@milecki.pl \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox