[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ccdb9b4c55b40ba984d4dc333f7a13c@AcuMS.aculab.com>
Date: Wed, 12 Jan 2022 09:38:40 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Martin Liška' <mliska@...e.cz>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] objtool: Fix -Wformat-truncation seen with GCC 12.
From: Martin Liška
> Sent: 12 January 2022 09:29
>
> The patch fixes the following warning that seems reasonable:
>
> check.c:2836:58: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a
> region of size 9 [-Werror=format-truncation=]
> 2836 | snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx);
Looks pretty unreasonable to me :-)
The domain of 'idx' is much smaller than that of 'int'.
Indeed the overflow can only actually happen if it is negative.
By then all sorts of other things will have gone wrong.
OTOH changing 16 to 60 is one way to STFU.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists