[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3d6a513b51d545cc87a7a0ae22452567@AcuMS.aculab.com>
Date: Mon, 28 Jun 2021 08:24:15 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'Chen, Rong A'" <rong.a.chen@...el.com>,
Ilya Dryomov <idryomov@...il.com>,
kernel test robot <lkp@...el.com>
CC: "kbuild-all@...ts.01.org" <kbuild-all@...ts.01.org>,
"clang-built-linux@...glegroups.com"
<clang-built-linux@...glegroups.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: RE: [kbuild-all] Re: net/ceph/messenger_v2.c:2808:5: warning: stack
frame size (2336) exceeds limit (2048) in function 'ceph_con_v2_try_read'
...
> >> arch/powerpc/include/asm/io-defs.h:43:1: warning: performing pointer arithmetic on a null
> pointer has undefined behavior [-Wnull-pointer-arithmetic]
I've just realised why that error is output.
The result of (long)((char *)0 + 4) is only 4 if the NULL pointer
has the 'all-zero' bit pattern.
This isn't mandated by the language.
However I suspect almost every implementation of C there has ever
been has used the all-zero bit pattern for NULL.
This includes one system I used (many years ago) where the 'natural'
NULL pointer would have been the all-ones pattern.
Far too much code assumes memset(ptr, 0, len) will set pointers
to NULL for any other value to ever work.
Of course 'undefined behaviour' doesn't mean 'undefined value'
it includes firing a ICBM at the coder's house.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists