public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens•net>
To: linuxppc-dev@lists•ozlabs.org
Cc: Daniel Axtens <dja@axtens•net>
Subject: [PATCH 2/3] powerpc/sparse: constify the address pointer in __get_user_nocheck
Date: Mon, 30 Jan 2017 17:41:54 +1100	[thread overview]
Message-ID: <20170130064155.30281-3-dja@axtens.net> (raw)
In-Reply-To: <20170130064155.30281-1-dja@axtens.net>

In __get_user_nocheck, we create an intermediate pointer for the
user address we're about to fetch. We currently don't tag this
pointer as const. Make it const, as we are simply dereferencing
it, and it's scope is limited to the __get_user_nocheck macro.

Signed-off-by: Daniel Axtens <dja@axtens•net>

---

This squashes 52 sparse warnings in my pseries build. They're
similar to the ones squashed in the previous patch.
---
 arch/powerpc/include/asm/uaccess.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 71d81cbe3781..44ded4193001 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -261,7 +261,7 @@ do {								\
 ({								\
 	long __gu_err;						\
 	unsigned long __gu_val;					\
-	__typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
+	const __typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
 	__chk_user_ptr(ptr);					\
 	if (!is_kernel_addr((unsigned long)__gu_addr))		\
 		might_fault();					\
-- 
2.9.3

  parent reply	other threads:[~2017-01-30  6:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30  6:41 [PATCH 0/3] powerpc/sparse: constify addresses in get_user macros Daniel Axtens
2017-01-30  6:41 ` [PATCH 1/3] powerpc/sparse: constify the address pointer in __get_user_check Daniel Axtens
2017-02-02 11:45   ` [1/3] " Michael Ellerman
2017-01-30  6:41 ` Daniel Axtens [this message]
2017-01-30  6:41 ` [PATCH 3/3] powerpc/sparse: constify the address pointer in __get_user_nosleep Daniel Axtens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170130064155.30281-3-dja@axtens.net \
    --to=dja@axtens$(echo .)net \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox