Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp810646img; Mon, 18 Mar 2019 14:59:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6INWnANfcsN7Ndq8VHk35zrlJoM8uu3SCA62dqBC3IwcsqBMXGbJ5LYKJeq18D55KYW6z X-Received: by 2002:a62:12c8:: with SMTP id 69mr8591046pfs.184.1552946345869; Mon, 18 Mar 2019 14:59:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552946345; cv=none; d=google.com; s=arc-20160816; b=x/iAY2oVjKAZSpslKmsrU0QqgOG8OXsd8qkkVyXlq8sqCbKr+hHue1onqYdiRIaldy bpj/gKNsseoy+a0Vv2XeM3GWcQlHcT1zco20GyjrB0vS60Wfq914XzpzsT/ExJQy6+ip +WT+SZIuSfscXS4MLzWKBcA9PfXLXD+N5cWxGdDKifKcQhbaqHjSKVPWGykeKwOEYxiM E/rrKmM/tSCmZ6BES07buQdcuLnxPMN25Vp/v/V8ZOVSESCwgoH3wgUBL8f6Gh+8EAGl yLZI+Pov6jcGRvRcHqFOPFKRa0fkcJcsBd2u+XQBJMgb+9OuiAl1RlRs0TZlDFYPWdQl E5lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=oOoGoGfRPT3mRse49s3/zc4aL6pQ4YO//onrsS8nP9U=; b=i+3I4DWoUS26K06hEAV7mP86GuU1TxglDVnTy0RfQcpJEmDrONn4P1sXbeUJH9b21N zMeUaEx7kHYXX5SCRH8QQK+aU2SBWUj60dIdHua1fo+GAIRZTaf6RaH2Cn5ROgX/WJv7 5dp6Nfh8iPH0+G145JV2gclap5bfFb+Kyfv7Yh74Y2YHRbUIFqi6uC7y72+NGxuEIEo/ Y5EhfoA9oogSN+jlzQaxGK3npnwzOqz4mmyHEmLolsLjWXqDGwLBory47X94hPDlULGW QC7mQCikn66Gk8UwoJbatsTjoIGLPM+KgKwfEa56QgQk9fjMsHWSvsC/2RizkrkDbzk9 aZdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=QpSb4BYy; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4si9564811pgv.118.2019.03.18.14.58.49; Mon, 18 Mar 2019 14:59:05 -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; dkim=pass header.i=@broadcom.com header.s=google header.b=QpSb4BYy; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727304AbfCRV6I (ORCPT + 99 others); Mon, 18 Mar 2019 17:58:08 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42611 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726896AbfCRV6H (ORCPT ); Mon, 18 Mar 2019 17:58:07 -0400 Received: by mail-pf1-f193.google.com with SMTP id r15so9434588pfn.9 for ; Mon, 18 Mar 2019 14:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=oOoGoGfRPT3mRse49s3/zc4aL6pQ4YO//onrsS8nP9U=; b=QpSb4BYys1mBZkzz7QB+tzlVBl//xoDpo59FtObNBEmOx1qecVkKqiLaOa3GavsofY 31F4RrTdRJTlYYywmlh6JVagA0GiRQo+xkdCPGiKl/R3pNUbyQQkxXbm2wO8HLMAn9Xe LWEqL/SvKV6QuKhSZEJ+vDf8r9l6ZDFwFxfwQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=oOoGoGfRPT3mRse49s3/zc4aL6pQ4YO//onrsS8nP9U=; b=hYe9hfY7qou++OpzQjDV7XZAmZ/vcPb6/JDA+n5NYrTTN3n1kqyiSn23qkN//l76yw /j/iuzixUWn+nii5YM1mlBpVsybCTDg75fQS25FBf/ljLEhJMoRxQ4ewe8PBmkoWL2eI gzvUrMSD8R4F28iHL6+0+ptR8yXdu48QhTTbpnO0UWbx0D0Ed3c+z2mhTxuDknQ+tthK a9DEs1iwHBZJ12oBpoULkCzvXdj3sqdUJsk8fLS/1PxCKLzQW+XkBmuyK3ETL5DU/4sX 5kPE4rRPLjFEQIcWz9cKGXdiA8cKJ9hmDmkv3ZuPjVcqmcVP65L+aYY5B2VfRJXkh7oz zTsA== X-Gm-Message-State: APjAAAV1w9tTOsXg4FVJfKo8xYebyx/Uh68VbxPG8J1TXUjq28bJQBP8 l1xGUjYXv9Yvq/wL94mIiEgTuhSt6ifFELjDK0ZP28WFH7En0CYVpdhrqDuHknML+KRFlVgPfZI OTfp/vAt8BL21xWIVrvXHMEGRgTyZ3hVSWe1VVzFrHPePlGSdllFiQjhQNBMyKmmpW7ypxHtofX Bwhug= X-Received: by 2002:a17:902:266:: with SMTP id 93mr22355724plc.161.1552946286484; Mon, 18 Mar 2019 14:58:06 -0700 (PDT) Received: from [10.69.37.149] ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id p86sm21177292pfa.104.2019.03.18.14.58.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Mar 2019 14:58:05 -0700 (PDT) Subject: Re: [PATCH] scsi: lpfc_nvme: Fix wrong sizeof argument To: James Bottomley , "Gustavo A. R. Silva" , Dick Kennedy , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190318171505.GA8748@embeddedor> <1552931093.3203.25.camel@linux.ibm.com> From: James Smart Message-ID: <872b6dcf-929c-9e2c-3c71-0b2943191c9f@broadcom.com> Date: Mon, 18 Mar 2019 14:58:03 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <1552931093.3203.25.camel@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/18/2019 10:44 AM, James Bottomley wrote: > 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 > Agree with James on style.   This one reference was a little interesting. It purposely was something smaller than the whole structure as the latter end of the structure ends up getting set later.  But not a big deal to correct as indicated. --james