Re: [PATCH] fs: lockd: avoid possible wrong NULL parameter
From: Su Hui
Date: Wed Aug 02 2023 - 23:08:51 EST
On 2023/8/2 18:41, Dan Carpenter wrote:
There was a big fight about memcpy() in 2010.
https://lwn.net/Articles/416821/
It's sort of related but also sort of different. My understanding is
that the glibc memcpy() says that memcpy() always does a dereference so
it can delete all the NULL checks which come after. The linux kernel
uses -fno-delete-null-pointer-checks to turn this behavior off.
Really big fight!
This article seems talk about problem that using memcpy() to copy
overlapping regions.
I'm not sure glibc memcpy does the check about NULL, but glibc printf
does this check.
"And GNU libc checks strings passed to printf for a %s placeholder for
NULL,
when the C standard says this is not allowed."[1]
[1] https://lwn.net/Articles/416821/
regards,
dan carpenter