public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: lustre/lnet: Fix wrong type casting warning generated by sparse
@ 2016-02-13 18:04 Niranjan Dighe
  2016-02-13 21:49 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Niranjan Dighe @ 2016-02-13 18:04 UTC (permalink / raw)
  To: Oleg Drokin, Andreas Dilger, Greg Kroah-Hartman, Shivani Bhardwaj,
	Dmitry Eremin, Mike Rapoport, Shraddha Barke, Frank Zago,
	Hatice ERTÜRK, Mike Shuey
  Cc: lustre-devel, devel, linux-kernel

Fixed the following warning reported by sparse about typecasting. A
userspace pointer was being typecasted by simply (char *) which causes
sparse to give the following warning -

warning: cast removes address space of expression

Fixed it by adding __user annotation to the typecasting.

Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
---
 drivers/staging/lustre/lnet/selftest/console.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c
index 366211e..64b6a70 100644
--- a/drivers/staging/lustre/lnet/selftest/console.c
+++ b/drivers/staging/lustre/lnet/selftest/console.c
@@ -1461,9 +1461,9 @@ lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
 
 	sfwk_stat = (sfw_counters_t __user *)&ent_up->rpe_payload[0];
 	srpc_stat = (srpc_counters_t __user *)
-				      ((char *)sfwk_stat + sizeof(*sfwk_stat));
+				((char __user *)sfwk_stat + sizeof(*sfwk_stat));
 	lnet_stat = (lnet_counters_t __user *)
-				      ((char *)srpc_stat + sizeof(*srpc_stat));
+				((char __user *)srpc_stat + sizeof(*srpc_stat));
 
 	if (copy_to_user(sfwk_stat, &rep->str_fw, sizeof(*sfwk_stat)) ||
 	    copy_to_user(srpc_stat, &rep->str_rpc, sizeof(*srpc_stat)) ||
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-14  2:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-13 18:04 [PATCH] staging: lustre/lnet: Fix wrong type casting warning generated by sparse Niranjan Dighe
2016-02-13 21:49 ` Dan Carpenter
2016-02-14  2:45   ` Niranjan Dighe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox