Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2749884rwb; Thu, 17 Nov 2022 15:45:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5QDARSCdbdpDfO6OJHmc8WU1gromCUuC4yLP3L4aGz9yfaa9zBtGKKLMPXR4stUOWlpUZE X-Received: by 2002:a17:907:11cb:b0:7a6:598f:1fb1 with SMTP id va11-20020a17090711cb00b007a6598f1fb1mr3961415ejb.606.1668728716514; Thu, 17 Nov 2022 15:45:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668728716; cv=none; d=google.com; s=arc-20160816; b=c3V6aWO0rxV5gkmWOOIPdmIIYHXrKvc/YZFOGOBsQdOVYBnOgAkSfC6XcaPk9DwCsE VZtgOGGE9IvnT9Wwo5331EYpA/9mKuy6RLtyFmIz+ofQT5u8uYZjHY0sHALf7g07cXNg ndW+fH6OUA2toXYzj6zx2AjTMNu3qcIcODECFj+IBWQydx8Fkcdum2hgT9PV4z2ZauMY Zx1X38Dzdy4SAQbK0tOKqHrmNkQw0JRlsMzz18fpWvMe0EjoBDz4c0oMQnLP41QzoXBY o5fZHLWChlaAKT9Mvg3oUdsEftsWFbpbphQTHc3sSahInh2F07Rs8z/4C46/8v2BKyRy 9Qfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gcTIS+31JUOVRom7YlP+fLVbXgVJ60dkTvIabV7wbS8=; b=RyGlHGREnswfwvraJNiH+jLHbtQju/wQ384Q1BdzUG4n09dnWbzmqTLNnbFM9a+gKA /8C1Wq5KfbBRnQK9Ua2Vt9hKx3u8kZl6n9Rp8qVpwXm/MYMcRpi1+SdfktjiIL8Z0naa nZINrsi2FQBbV0C4U8tU+D8TfpSUzZ0irVeS6i2qJeL2qbGl9vrPblc5jvc1a+6ttNkH trD4WAzXsHKJKkOd9HFoq38Nh/8y3qvh6YHZ4NT9FeZMR11vMQ1BgsJFfVXAL56iK/OT yMozO8ag6i1ZVGSfN6lKNmFQTBpjIPKIE9hPnVwyDd+5T2DZvcNUiXH07q2WMhssWZ9w ICgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Ow/Fa2lQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rv14-20020a17090710ce00b0073ced0e9bb1si1306824ejb.189.2022.11.17.15.44.54; Thu, 17 Nov 2022 15:45:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Ow/Fa2lQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235086AbiKQXX3 (ORCPT + 91 others); Thu, 17 Nov 2022 18:23:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233865AbiKQXXP (ORCPT ); Thu, 17 Nov 2022 18:23:15 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D36274A91; Thu, 17 Nov 2022 15:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668727394; x=1700263394; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=1vf+nxtKsojFCFBBwNt1MycZfyiXZfZyH/YixPFSLlM=; b=Ow/Fa2lQiysdU6TqdjWVzqTc/bhhB1C0ddbuOzZdto9UkNvNL/MEyhz/ HNF9mP2SoiWObyxy6HqUgwCKR5oj+6D51T3z30OqQTk/jt++0GBEZoJnL aWV1I+/VdXGbs3vaggNibWN4vm/0R5OAmonPzKm2Fr/EXgahO5rOGZ5m0 UUkbD5rOmzZWuPkHlaa7nSEryg/Gb+uF/mC4yHtpADYTcDrFInEQwVHAM KgrcJWum+5MOsJPYCOL1OwbGbbR0DO6u8N9scK7fDwu/RcpWhHEfG7EY/ Ko2WcTm67eV8UD4AhsYnsLrzHB2SauFnmpCm6eZbWHJzTmQ9fCG3OE/Jy A==; X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="292704100" X-IronPort-AV: E=Sophos;i="5.96,172,1665471600"; d="scan'208";a="292704100" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 15:23:13 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="969064618" X-IronPort-AV: E=Sophos;i="5.96,172,1665471600"; d="scan'208";a="969064618" Received: from cvadim-mobl1.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.60.21]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 15:23:11 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 5FA7D109763; Fri, 18 Nov 2022 02:23:09 +0300 (+03) From: "Kirill A. Shutemov" To: jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org Cc: dave.hansen@linux.intel.com, David.Laight@ACULAB.COM, linux-kernel@vger.kernel.org, x86@kernel.org, "Kirill A. Shutemov" Subject: [PATCHv2] scsi: Fix get_user() in call sg_scsi_ioctl() Date: Fri, 18 Nov 2022 02:23:04 +0300 Message-Id: <20221117232304.1544-1-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org get_user() expects the pointer to be pointer-to-simple-variable type, but sic->data is array of 'unsigned char'. It violates get_user() contracts. Explicitly take pointer to the first element of the array. It matches current behaviour. This is preparation for fixing sparse warnings caused by Linear Address Masking patchset. Signed-off-by: Kirill A. Shutemov Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" --- drivers/scsi/scsi_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 2d20da55fb64..fdd47565a311 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -519,7 +519,7 @@ static int sg_scsi_ioctl(struct request_queue *q, fmode_t mode, return -EFAULT; if (in_len > PAGE_SIZE || out_len > PAGE_SIZE) return -EINVAL; - if (get_user(opcode, sic->data)) + if (get_user(opcode, &sic->data[0])) return -EFAULT; bytes = max(in_len, out_len); -- 2.38.0