From: Niranjan Dighe <niranjan.dighe@gmail.com>
To: "Oleg Drokin" <oleg.drokin@intel.com>,
"Andreas Dilger" <andreas.dilger@intel.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Shivani Bhardwaj" <shivanib134@gmail.com>,
"Dmitry Eremin" <dmitry.eremin@intel.com>,
"Mike Rapoport" <mike.rapoport@gmail.com>,
"Shraddha Barke" <shraddha.6596@gmail.com>,
"Frank Zago" <fzago@cray.com>,
"Hatice ERTÜRK" <haticeerturk27@gmail.com>,
"Mike Shuey" <shuey@purdue.edu>
Cc: lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [lustre-devel] [PATCH] staging: lustre/lnet: Fix wrong type casting warning generated by sparse
Date: Sat, 13 Feb 2016 23:34:35 +0530 [thread overview]
Message-ID: <20160213180435.GA16246@codebox> (raw)
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
WARNING: multiple messages have this Message-ID (diff)
From: Niranjan Dighe <niranjan.dighe@gmail.com>
To: "Oleg Drokin" <oleg.drokin@intel.com>,
"Andreas Dilger" <andreas.dilger@intel.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Shivani Bhardwaj" <shivanib134@gmail.com>,
"Dmitry Eremin" <dmitry.eremin@intel.com>,
"Mike Rapoport" <mike.rapoport@gmail.com>,
"Shraddha Barke" <shraddha.6596@gmail.com>,
"Frank Zago" <fzago@cray.com>,
"Hatice ERTÜRK" <haticeerturk27@gmail.com>,
"Mike Shuey" <shuey@purdue.edu>
Cc: lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] staging: lustre/lnet: Fix wrong type casting warning generated by sparse
Date: Sat, 13 Feb 2016 23:34:35 +0530 [thread overview]
Message-ID: <20160213180435.GA16246@codebox> (raw)
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
next reply other threads:[~2016-02-13 18:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-13 18:04 Niranjan Dighe [this message]
2016-02-13 18:04 ` [PATCH] staging: lustre/lnet: Fix wrong type casting warning generated by sparse Niranjan Dighe
2016-02-13 21:49 ` [lustre-devel] " Dan Carpenter
2016-02-13 21:49 ` Dan Carpenter
2016-02-14 2:45 ` [lustre-devel] " Niranjan Dighe
2016-02-14 2:45 ` Niranjan Dighe
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=20160213180435.GA16246@codebox \
--to=niranjan.dighe@gmail.com \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=dmitry.eremin@intel.com \
--cc=fzago@cray.com \
--cc=gregkh@linuxfoundation.org \
--cc=haticeerturk27@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=mike.rapoport@gmail.com \
--cc=oleg.drokin@intel.com \
--cc=shivanib134@gmail.com \
--cc=shraddha.6596@gmail.com \
--cc=shuey@purdue.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.