* [PATCH] thread_info: suppress sparse warning in check_copy_size()
@ 2017-07-26 22:27 AbdAllah-MEZITI
2017-07-26 22:41 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: AbdAllah-MEZITI @ 2017-07-26 22:27 UTC (permalink / raw)
To: luto
Cc: AbdAllah MEZITI, Mark Rutland, Kees Cook, Ingo Molnar,
Heiko Carstens, Kyle Huey, Sahara, Al Viro, linux-kernel
This patch fixes the following sparse warning in thread_info.h:
./include/linux/thread_info.h:129:18: warning: incorrect type in argument 1 (different modifiers)
./include/linux/thread_info.h:129:18: expected void *<noident>
./include/linux/thread_info.h:129:18: got void const *addr
Signed-off-by: AbdAllah MEZITI <abdallah.meziti.pro@gmail.com>
---
include/linux/thread_info.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 250a276..e2c4a8e 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -126,7 +126,7 @@ static inline void copy_overflow(int size, unsigned long count)
static __always_inline bool
check_copy_size(const void *addr, size_t bytes, bool is_source)
{
- int sz = __compiletime_object_size(addr);
+ int sz = __compiletime_object_size((void *)addr);
if (unlikely(sz >= 0 && sz < bytes)) {
if (!__builtin_constant_p(bytes))
copy_overflow(sz, bytes);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] thread_info: suppress sparse warning in check_copy_size()
2017-07-26 22:27 [PATCH] thread_info: suppress sparse warning in check_copy_size() AbdAllah-MEZITI
@ 2017-07-26 22:41 ` Linus Torvalds
2017-07-28 9:16 ` Luc Van Oostenryck
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2017-07-26 22:41 UTC (permalink / raw)
To: AbdAllah-MEZITI
Cc: luto, Mark Rutland, Kees Cook, Ingo Molnar, Heiko Carstens,
Kyle Huey, Sahara, Al Viro, lkml
This is wrong. The sparse version of __compiletime_object_size()
should just be fixed to take a 'const' pointer without complaints.
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] thread_info: suppress sparse warning in check_copy_size()
2017-07-26 22:41 ` Linus Torvalds
@ 2017-07-28 9:16 ` Luc Van Oostenryck
0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-07-28 9:16 UTC (permalink / raw)
To: Linus Torvalds
Cc: AbdAllah-MEZITI, luto, Mark Rutland, Kees Cook, Ingo Molnar,
Heiko Carstens, Kyle Huey, Sahara, Al Viro, lkml, Linux-Sparse,
Lance Richardson, Johannes Berg
On Thu, Jul 27, 2017 at 12:41 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> This is wrong. The sparse version of __compiletime_object_size()
> should just be fixed to take a 'const' pointer without complaints.
The underlying __builtin_object_size() has been fixed in the sparse tree
6 months ago or so.
-- Luc
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-28 9:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-26 22:27 [PATCH] thread_info: suppress sparse warning in check_copy_size() AbdAllah-MEZITI
2017-07-26 22:41 ` Linus Torvalds
2017-07-28 9:16 ` Luc Van Oostenryck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).