Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp156537ybi; Tue, 18 Jun 2019 19:45:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqz46hAeZ7pn7sbotytWZRjyVA4jjCNXzhyljZlrfrU5yzIs8lLU9aunGYmae10B2Xq/nq5v X-Received: by 2002:a62:303:: with SMTP id 3mr6894508pfd.118.1560912347950; Tue, 18 Jun 2019 19:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560912347; cv=none; d=google.com; s=arc-20160816; b=NGaqhlzigT4Pk78zhab8CnzzXsX3TDkmvbcttzNlnckPVZ8W19eEkWlwE+UYmoy+OO 176zJbVw5y7ucIPKGhC4r0MbCpSpwZrtp6CDit9CwkxflG4jSyj5AFYkNvWp6iWbflwO tU3PB6Riu0Be46j7uAj3WOTdEuH8w83Ftl5Q7t62qHkHbSv4YxMUUgvek73hT/bYbRxI cUPIS4hrg6ooB0vTHQTTc7nvJ3eq8Yu9Ecw4uJ8TNd4iBLdkA3BEeT0EGTc8efdzxLb0 1aoL3IfJjHT8ibM5FC52qij7mZRe0+TJnHBiijg7GerstMCrA3tJUcC9RD4pbG2eEpZy 2KtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:organization:from:subject:cc:to :dkim-signature; bh=VLQ+HJbgpmoE8VBgWRCt6rLQFlu2VXg32E2waD5MT30=; b=wX8JEVeLLyaVZlKyz/GmyEBB/DjeDRXFYXYO/mdna3t07h0wsKGZumEyMAFsMdFP1o WkYA5ZXOxIfg5rY7PYT+0Ezbn6aVtgO7gvYZ6xzPyFGq0MQThLzLlgLKS9iCKQXQWFMz s3CJxvvZWcriG4dUZP3x2avP4N8NnSgyaNpJigE22sLPRa0xWAoVuifv/uyCLklntdC0 vl+woMhU+L2j4QGZuxwNbLu48jaATCvo6b74pcjVHpGiiCiiuZyqkhpAGApfltgyAlTu 7ySb2lY1fCQjoEq4aipx3ULDwFefjAV/sI9CA8xYS3aoBV/iX2vI+RvK8iph1LitHoQQ MnUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=bho3lQ9P; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si14982970pfa.74.2019.06.18.19.45.31; Tue, 18 Jun 2019 19:45:47 -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=@oracle.com header.s=corp-2018-07-02 header.b=bho3lQ9P; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729642AbfFSCp1 (ORCPT + 99 others); Tue, 18 Jun 2019 22:45:27 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:35760 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbfFSCp0 (ORCPT ); Tue, 18 Jun 2019 22:45:26 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5J2iICo061175; Wed, 19 Jun 2019 02:45:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : subject : from : references : date : in-reply-to : message-id : mime-version : content-type; s=corp-2018-07-02; bh=VLQ+HJbgpmoE8VBgWRCt6rLQFlu2VXg32E2waD5MT30=; b=bho3lQ9P1UvLWrwwphxjVAciAdEAd9lo/bfkq982ti7mKMtMII6hks+x2Y4U8F1WQljN pFkkBHe1nWQag+EqBnmIVZDZrMnvrRI7vFFeZoUE3jTHrVXRZXX4KeQANWeCwFQL+JEJ bLNXV0UcxGP38VXgri+CmgltB7JY+nMltHaat08c6ryNEkB6YuULpnI34wIls4ayBwCg 0OogoKEQHq5MVQtd95KfY0SmYYZtKLPFg8g8GwJA1x/RCCcOSkkhkXSK2CK7HqRX7Wkb 7lGU93c4sppTJ7nm0Ewh8sYbve2guc9OQlt80DHdl60gB/vMQ4c/JRiHbuXK1qPOOshl zw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2t78098pw5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 02:45:12 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5J2heaa091822; Wed, 19 Jun 2019 02:45:12 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2t77ymtthw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 02:45:12 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5J2jBuH000851; Wed, 19 Jun 2019 02:45:11 GMT Received: from ca-mkp.ca.oracle.com (/10.159.214.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Jun 2019 19:45:11 -0700 To: "Gustavo A. R. Silva" Cc: Kashyap Desai , Sumit Saxena , Shivasharan S , "James E.J. Bottomley" , "Martin K. Petersen" , megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] scsi: megaraid_sas: Use struct_size() helper From: "Martin K. Petersen" Organization: Oracle Corporation References: <20190607184053.GA11513@embeddedor> Date: Tue, 18 Jun 2019 22:45:08 -0400 In-Reply-To: <20190607184053.GA11513@embeddedor> (Gustavo A. R. Silva's message of "Fri, 7 Jun 2019 13:40:53 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=653 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906190020 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=698 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906190020 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gustavo, > One of the more common cases of allocation size calculations is finding > the size of a structure that has a zero-sized array at the end, along > with memory for some number of elements for that array. For example: > > struct MR_PD_CFG_SEQ_NUM_SYNC { > ... > struct MR_PD_CFG_SEQ seq[1]; > } __packed; > > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes. Applied to 5.3/scsi-queue, thanks! -- Martin K. Petersen Oracle Linux Engineering