Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1697599 > unrolled thread

[PATCH] thread_info: suppress sparse warning in check_copy_size()

Started byAbdAllah-MEZITI <abdallah.meziti.pro@gmail.com>
First post2017-07-27 00:30 +0200
Last post2017-07-28 11:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] thread_info: suppress sparse warning in check_copy_size() AbdAllah-MEZITI <abdallah.meziti.pro@gmail.com> - 2017-07-27 00:30 +0200
    Re: [PATCH] thread_info: suppress sparse warning in check_copy_size() Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-27 00:50 +0200
      Re: [PATCH] thread_info: suppress sparse warning in check_copy_size() Luc Van Oostenryck <luc.vanoostenryck@gmail.com> - 2017-07-28 11:20 +0200

#1697599 — [PATCH] thread_info: suppress sparse warning in check_copy_size()

FromAbdAllah-MEZITI <abdallah.meziti.pro@gmail.com>
Date2017-07-27 00:30 +0200
Subject[PATCH] thread_info: suppress sparse warning in check_copy_size()
Message-ID<u7CYy-6ee-11@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1697604

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2017-07-27 00:50 +0200
Message-ID<u7DhT-6kZ-7@gated-at.bofh.it>
In reply to#1697599
This is wrong. The sparse version of __compiletime_object_size()
should just be fixed to take a 'const' pointer without complaints.

               Linus

[toc] | [prev] | [next] | [standalone]


#1698612

FromLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Date2017-07-28 11:20 +0200
Message-ID<u89B7-1Pt-5@gated-at.bofh.it>
In reply to#1697604
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web