Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp636348img; Mon, 18 Mar 2019 10:46:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqygwaoIqAfo3HIfpM7rl4j3cEf8r6zLSdgKLuDOCkNj3O0hlhKltAv7Gn/o8H//mHal490r X-Received: by 2002:a17:902:7289:: with SMTP id d9mr20974266pll.314.1552931199483; Mon, 18 Mar 2019 10:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552931199; cv=none; d=google.com; s=arc-20160816; b=th7d9lty2zZ+jwjdjW9yaA+5v4xj6fnRoSnvUbyKA0zQz4LGXvDcvi9PC0kgFzUWxo dZdrQPYJ/PmweoVYmNCgzelKC3H1YIGJilo+Bp3rpB7JuVuQWfDOsd/OVfmOWesCcG/y e3mxHx/PRX/1FLuRCiUtRrGjDJScPn6JdkdlOJV7LObsQpca7bOw8Fqa2jdWspXoB8qK YO3pxKBeItbj3g89yHgQyxoHRbLiRkPHxzfuP5IPI0YVErkW8sCbeeIpxctEI4vgDod1 RtVy34FjljnLf4B+5dSwnL0ubgdZbtPw0h4s01qnRxYdoRgdYSzxx5Q3/uXBs+Y4tZOH 9qIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject; bh=LfitAPju/XOPCa4Z7maksWNNzhpfH0dBpRYTikpxabs=; b=OW8ECSDF4tv9u18wPqvWbmEw3hKsJzyusUYrscDX3u78B6yiozIfppKdPdQQeiJk26 wspY36Cq9dvbTiAGlARw0fE+gAnuqeru0sRncAxv8rq6OYDz50jSf3B5SztbwnKEhHGW DnguWXoozXNlf9LStPxWtPYzbMN9nHHj4wqfSVnRqm2D4/35l/2uL0ibZSlhJevV2zGx I8np/VKUh2aFDyuQQ2mx2tlkW6Q5NkxF+U7od7Kvnutgl3bhkzWxM9+1vfQeS3ToJjUz SflkvbHF6q4PycaUSXgyZGxaK6wqvQvNqoh/sHBna+sRMCZhpVb4dOjotI50c7KsBDWu DPWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t18si6118565plr.78.2019.03.18.10.46.24; Mon, 18 Mar 2019 10:46:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728146AbfCRRph (ORCPT + 99 others); Mon, 18 Mar 2019 13:45:37 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37156 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727933AbfCRRpf (ORCPT ); Mon, 18 Mar 2019 13:45:35 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2IHjUYo071343 for ; Mon, 18 Mar 2019 13:45:33 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0b-001b2d01.pphosted.com with ESMTP id 2raefk4fd0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Mar 2019 13:45:31 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Mar 2019 17:44:57 -0000 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 18 Mar 2019 17:44:54 -0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2IHitDp27656268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Mar 2019 17:44:55 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 68FB96E04E; Mon, 18 Mar 2019 17:44:55 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2174C6E04C; Mon, 18 Mar 2019 17:44:54 +0000 (GMT) Received: from jarvis.ext.hansenpartnership.com (unknown [9.85.131.215]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 18 Mar 2019 17:44:53 +0000 (GMT) Subject: Re: [PATCH] scsi: lpfc_nvme: Fix wrong sizeof argument From: James Bottomley To: "Gustavo A. R. Silva" , James Smart , Dick Kennedy , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 18 Mar 2019 10:44:53 -0700 In-Reply-To: <20190318171505.GA8748@embeddedor> References: <20190318171505.GA8748@embeddedor> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19031817-0020-0000-0000-00000ECA4318 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010780; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000281; SDB=6.01176223; UDB=6.00615206; IPR=6.00956908; MB=3.00026037; MTD=3.00000008; XFM=3.00000015; UTC=2019-03-18 17:44:56 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19031817-0021-0000-0000-000065220FDC Message-Id: <1552931093.3203.25.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-18_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903180131 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-03-18 at 12:15 -0500, Gustavo A. R. Silva wrote: > sizeof() is currently using the wrong argument when used in a call to > memset(). Notice that wqe is a pointer to union lpfc_wqe128, not to > union lpfc_wqe. > > Fix this by using union lpfc_wqe128 instead of lpfc_wqe as argument > of sizeof(). > > Addresses-Coverity-ID: 1443938 ("Wrong sizeof argument") > Fixes: 5fd1108517d9 ("scsi: lpfc: Streamline NVME Initiator WQE > setup") > Cc: stable@vger.kernel.org > Signed-off-by: Gustavo A. R. Silva > --- > drivers/scsi/lpfc/lpfc_nvme.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/lpfc/lpfc_nvme.c > b/drivers/scsi/lpfc/lpfc_nvme.c > index d16ca413110d..3dc0c85c7d50 100644 > --- a/drivers/scsi/lpfc/lpfc_nvme.c > +++ b/drivers/scsi/lpfc/lpfc_nvme.c > @@ -1981,7 +1981,7 @@ lpfc_get_nvme_buf(struct lpfc_hba *phba, struct > lpfc_nodelist *ndlp, > /* Fill in word 3 / sgl_len during cmd submission */ > > /* Initialize WQE */ > - memset(wqe, 0, sizeof(union lpfc_wqe)); > + memset(wqe, 0, sizeof(union lpfc_wqe128)); Actually the correct way to avoid potential problems like this is memset(wqe, 0, sizeof(*wqe)); James