From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751726AbcBNDWF (ORCPT ); Sat, 13 Feb 2016 22:22:05 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33606 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751256AbcBNDWE (ORCPT ); Sat, 13 Feb 2016 22:22:04 -0500 Date: Sun, 14 Feb 2016 08:51:48 +0530 From: Niranjan Dighe To: Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , Shivani Bhardwaj , Dmitry Eremin , Mike Rapoport , Shraddha Barke , Frank Zago , Hatice =?iso-8859-1?Q?ERT=DCRK?= , Mike Shuey Cc: lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: lustre/lnet: Fix wrong typecasting warning generated by sparse Message-ID: <20160214032148.GA19507@codebox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the following warning generated about type casting by sparse warning: cast removes address space of expression The current implementation casts the structure pointers with (char *) without __user annotation and then adds sizeof struct to it, thereby generating the sparse warning. Fixed this by removing the unnecessary char pointer type cast. Signed-off-by: Niranjan Dighe --- drivers/staging/lustre/lnet/selftest/console.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 366211e..bc236c9 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1460,10 +1460,8 @@ lstcon_statrpc_readent(int transop, srpc_msg_t *msg, return 0; sfwk_stat = (sfw_counters_t __user *)&ent_up->rpe_payload[0]; - srpc_stat = (srpc_counters_t __user *) - ((char *)sfwk_stat + sizeof(*sfwk_stat)); - lnet_stat = (lnet_counters_t __user *) - ((char *)srpc_stat + sizeof(*srpc_stat)); + srpc_stat = (srpc_counters_t __user *)(sfwk_stat + 1); + lnet_stat = (lnet_counters_t __user *)(srpc_stat + 1); 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