[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdaPNxRyJDtbEu4DB8SikMtBmr8cOJxOuKPUi6GwcoQtCg@mail.gmail.com>
Date: Tue, 14 Nov 2023 14:44:09 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Chester Lin <clin@...e.com>
Cc: NXP S32 Linux Team <s32@....com>, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] pinctrl: s32cc: Avoid possible string truncation
On Tue, Nov 7, 2023 at 3:10 PM Chester Lin <clin@...e.com> wrote:
> With "W=1" and "-Wformat-truncation" build options, the kernel test robot
> found a possible string truncation warning in pinctrl-s32cc.c, which uses
> an 8-byte char array to hold a memory region name "map%u". Since the
> maximum number of digits that a u32 value can present is 10, and the "map"
> string occupies 3 bytes with a termination '\0', which means the rest 4
> bytes cannot fully present the integer "X" that exceeds 4 digits.
>
> Here we check if the number >= 10000, which is the lowest value that
> contains more than 4 digits.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202311030159.iyUGjNGF-lkp@intel.com/
> Signed-off-by: Chester Lin <clin@...e.com>
Thanks for fixing this!
Patch applied for fixes.
Yours,
Linus Walleij
Powered by blists - more mailing lists