Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2409464pxb; Wed, 9 Feb 2022 18:38:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBmMUDXm6XxR6rkA36a0MxqG/eFPKToUOcEAZW5afMpQiBinrw0ESHAHuQrdrUNw/qGSGh X-Received: by 2002:a17:90b:38c7:: with SMTP id nn7mr449493pjb.124.1644460703244; Wed, 09 Feb 2022 18:38:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644460703; cv=none; d=google.com; s=arc-20160816; b=nskZwLUc2NQUYTAygHE8MIaYLU/AjwIOGNzRx4lEWgGBb+sNysCv58hlGfJsLDjObR B3MCu3Q1oXqVYNdVGZ2b/H1weMovPx6hdh4ZBG4n+fPvpuebeN6wTGfGlzui0RclCPPb AvxRE5TrdMNbqquBgYL1yl35jtY6bC9OL2ZPof6xDcfEtMiQILLERt56uvQ7Kgc+dMjp C9irjH4/qilvXpP3vYsNZQG4X5l+Uo+VkxYrz5nQx2Gisa7pC4IVUtTGihfbuyhYGmiw jwzs7LZldJzg9mxBvn1ClL9SPSAUR6EqKEkDY51JgnkIm9R5NffW8W7kRIi3KucRV+q0 TuXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=TWrJe7V8b7P4SgEJomUdsQa1XDxtIcBfokIBJf6ebF8=; b=iNqZ22vsCc4ggLOTkvbibcfSfi6EcuV9WeGgqMNY9Dr9k70pHFzcBbLr400mTv7jSu Qf92l2PHb0EBcpez+3QE4DexmyJUQCa85sM5+p4TSvMeF8YBrWJ7PFLdM7TcwPmVc88z EqVlGyN6zVrwhlrvAk362WcBm6wIUH5pC5QXzIqbduhI2mz+d8XuEi8Euiiffu7q4h+S oYPLAlAgb+F0Q5GAoj1MvzNl2OuceJo551BG3n8AJ4D+FIJN3BnZF3hUnTW0ihRclJM5 cFu4dp/bJWQMAAnsQyR1kW3WXmJ540P07VKbVVOqBiu/3pLQ+yu5CyZTKnQC/K5v2bxe igLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=VM+lN6lR; 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=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot7si282095pjb.1.2022.02.09.18.38.11; Wed, 09 Feb 2022 18:38:23 -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=@ibm.com header.s=pp1 header.b=VM+lN6lR; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234362AbiBJB7J (ORCPT + 99 others); Wed, 9 Feb 2022 20:59:09 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:33842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234083AbiBJB6C (ORCPT ); Wed, 9 Feb 2022 20:58:02 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A80A2B6A8; Wed, 9 Feb 2022 17:44:09 -0800 (PST) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 219KbNAI017565; Wed, 9 Feb 2022 23:53:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=TWrJe7V8b7P4SgEJomUdsQa1XDxtIcBfokIBJf6ebF8=; b=VM+lN6lRz2vPrMVqeI9dIH5KgC4x5nxqXV+bKPScNx/ONJAFWkimM793DglI9Et7F0eo vUJf6JGrTk5EvOCdNTK11TwoAdDa0rdUdXiJwpdWTH3Zuh0BDAb+yK/HXEhWJH3HAzF0 C2YmXgNzxdmU/ATEGxdAFC7Hkg1je3uCcKqScAAq9VOPgS3/2pG0oeM8mfrDveE5GXBA jpF5WywAKvhHXw5mBUgRobUR8maZocY2pVl8NfQHlXOnComC/yGA7W2AWJ3pGVTPdNwe RrEGnAConRTS2AkUNErsZuyEqV7VY63a2Ect/4l6uWFP6e1/ikjxii+S/m6N0MiOE4jY 9g== Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e4kt24gx6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Feb 2022 23:53:25 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 219NXeML016792; Wed, 9 Feb 2022 23:53:24 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma04wdc.us.ibm.com with ESMTP id 3e2btb8q4c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Feb 2022 23:53:24 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 219NrNDP31326682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Feb 2022 23:53:23 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76D85BE054; Wed, 9 Feb 2022 23:53:23 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 198E9BE051; Wed, 9 Feb 2022 23:53:22 +0000 (GMT) Received: from oc6857751186.ibm.com (unknown [9.160.68.97]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 9 Feb 2022 23:53:21 +0000 (GMT) Subject: Re: [PATCH] scsi: ibmvscsis: Silence -Warray-bounds warning To: Kees Cook , Michael Cyr Cc: Stephen Rothwell , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20220208061231.3429486-1-keescook@chromium.org> From: Tyrel Datwyler Message-ID: <53b3e9c5-23c1-3825-8286-b4a65b69067b@linux.ibm.com> Date: Wed, 9 Feb 2022 15:53:21 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <20220208061231.3429486-1-keescook@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: FZYcKikhTuyVu6wCuSbwt--0m9GwQwIc X-Proofpoint-ORIG-GUID: FZYcKikhTuyVu6wCuSbwt--0m9GwQwIc Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-09_12,2022-02-09_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1011 phishscore=0 bulkscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202090123 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 2/7/22 10:12 PM, Kees Cook wrote: > Instead of doing a cast to storage that is too small, add a union for > the high 64 bits. Silences the warnings under -Warray-bounds: > > drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function 'ibmvscsis_send_messages': > drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:1934:44: error: array subscript 'struct viosrp_crq[0]' is partly outside array bounds of 'u64[1]' {aka 'long long unsigned int[1]'} [-Werror=array-bounds] > 1934 | crq->valid = VALID_CMD_RESP_EL; > | ^~ > drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:1875:13: note: while referencing 'msg_hi' > 1875 | u64 msg_hi = 0; > | ^~~~~~ > > There is no change to the resulting binary instructions. > > Reported-by: Stephen Rothwell > Link: https://lore.kernel.org/lkml/20220125142430.75c3160e@canb.auug.org.au > Cc: Michael Cyr > Cc: "James E.J. Bottomley" > Cc: "Martin K. Petersen" > Cc: Tyrel Datwyler > Cc: linux-scsi@vger.kernel.org > Cc: target-devel@vger.kernel.org > Signed-off-by: Kees Cook > --- > drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 9 +++------ Reviewed-by: Tyrel Datwyler