Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1407453pxb; Fri, 21 Jan 2022 17:57:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTzfOmBGJ2vBYSHEYwn/x8uSGePIYPI2VhAQA4mOXYrs26MzN28ZzNP9OWAfkzXNh/05jj X-Received: by 2002:a17:902:a3c7:b0:14a:d8bf:4e09 with SMTP id q7-20020a170902a3c700b0014ad8bf4e09mr6402863plb.62.1642816671096; Fri, 21 Jan 2022 17:57:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642816671; cv=none; d=google.com; s=arc-20160816; b=IpTkO2bgSX9hUSoicIzrFMqNvtrNcmAveUKG0Oe2WPwNr9SwuIsk+bhr9tOLCm8gSR RBHd/geKr4KEpkzXcoqtH7Aoe7eZq7vhiCo0/Vvpjn6C8O7Wx7kXZG1h0VgwF5sb3ace r4E79+3+TVAy0m+ImgJeFLgwrR8uryCQZm6bCUCoHhXloOQ3hbKozggx+57MZEf6yNO8 IinzJAj96u/CUHPeoQdmm1usHHOJJgzQvYiHJFhyNp282vSoN6oVGBpUnbj6Q/Ebbrtf NDjZLCq1AeCMLzCl6pKzBbdQ8AIhW55hamYHcmp/xX7VerHwPJldUEF+xPcveS3f/uw9 WbXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:dkim-signature; bh=kytrEWZ9vHuQBWDT3D9VZ4/u4ZwGzsRQyn7am4nCe9A=; b=M65gjsmu9peUfS7y5GBEx3ppnswWRpRIGiTXVBBbmngXV7l4zgW9CBrJwxFo2dP8xj icuV0Zh6nuPMyX1df3GWgl4kcT5iutXThjljEzPeBwXN52FvfKLV0Q5MdqTkplUr2QPb bQ/2Mv2Pb3PKYELhFQRHWNCF8CzwUXiUG1BpO2Z7prvb2rBEm6nMDVl1J4lF79dvLHCN GUr95WlYqv5FMZp1xLPYmf+mSUb1RR9vvTPDHZHIsELYAqIOCIHFGnVYX+/XJxxnOrqn eayCPqs9IiMDAUlM7xkjA+QKiDDTAUL6SzENmfhrU/2AmpY5DFKf6q12GprhVTl8Iqim JIVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=e2F4wgWj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i36si10581247pgb.658.2022.01.21.17.57.39; Fri, 21 Jan 2022 17:57:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=e2F4wgWj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381805AbiAUQZE (ORCPT + 99 others); Fri, 21 Jan 2022 11:25:04 -0500 Received: from ale.deltatee.com ([204.191.154.188]:42922 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232442AbiAUQZD (ORCPT ); Fri, 21 Jan 2022 11:25:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:content-disposition; bh=kytrEWZ9vHuQBWDT3D9VZ4/u4ZwGzsRQyn7am4nCe9A=; b=e2F4wgWjQ2SGCE7U40qgI5ddIj GEZMV67QFl9GAX3aE5cL4wspFp0IJ7uSr8USQfKTg9z1X4rG1QKxKaTOpJMFUdz0cwtA7K0MdAOFM HUH6a6UvJemzx1a2wZFde+Cl0o4BMaIqw4TJRQNHcPQFqGBdJiNuCVPnFYM5TQUtkuVzbm5kHHqPZ Ox6CE54rqIdRblbMTVkz4sAGp7h93H/Rhfz8ootaZRQrE1bLu+03FkbqmkLDna7HyBXSTNZovf9rV nn8sBggtEgNfrglVRfUWrC6lcyZx4gnA71LTKSqpp2pT4ck6f2l6xxmtYiCogdm9cB4aoxJD5Ne0N qyeoGvGg==; Received: from s0106a84e3fe8c3f3.cg.shawcable.net ([24.64.144.200] helo=[192.168.0.10]) by ale.deltatee.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nAwij-000Rlw-FT; Fri, 21 Jan 2022 09:25:02 -0700 To: "Gustavo A. R. Silva" , Jon Mason , Dave Jiang , Allen Hubbe Cc: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20220120230247.GA40182@embeddedor> From: Logan Gunthorpe Message-ID: Date: Fri, 21 Jan 2022 09:24:59 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20220120230247.GA40182@embeddedor> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 24.64.144.200 X-SA-Exim-Rcpt-To: linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, allenbh@gmail.com, dave.jiang@intel.com, jdmason@kudzu.us, gustavoars@kernel.org X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-5.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, LR_URI_NUMERIC_ENDING,NICE_REPLY_A autolearn=no autolearn_force=no version=3.4.6 Subject: Re: [PATCH][next] NTB/msi: Use struct_size() helper in devm_kzalloc() X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-01-20 4:02 p.m., Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version, > in order to avoid any potential type mistakes or integer overflows that, > in the worst scenario, could lead to heap overflows. > > Also, address the following sparse warnings: > drivers/ntb/msi.c:46:23: warning: using sizeof on a flexible structure > > Link: https://github.com/KSPP/linux/issues/174 > Signed-off-by: Gustavo A. R. Silva Thanks, looks good to me. Reviewed-by: Logan Gunthorpe