Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp932070yba; Thu, 4 Apr 2019 00:24:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwf38j0s+LjkryQWrGCX3Xw9nRNNFMtr2nAo8MEAWtaiDpIeL1ORbILtnzjuhA7YpOSR4jz X-Received: by 2002:a17:902:9004:: with SMTP id a4mr4796757plp.223.1554362684416; Thu, 04 Apr 2019 00:24:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554362684; cv=none; d=google.com; s=arc-20160816; b=SC033Zvoey0Dk8M0EtVn+WczhUjylMDSPBmA5A6uBM8sO285synw0HpQBb7BNsKtdB 8F3r9m2npt6mC9M2jrh/9OB0o0KT3upcf0GKyAjXXQAMhp7XEM/6+1Ao9OpU35/ojgrX vkUrtsZeTLXPg+ndYKoaNwLhV0b6TW5Et4y0nngZz9Db2lWepoToo6K8g8fc5da4PM1i R6j9y2rsNtCpUY2GNeQxQMai/LAUSLc1tDOykmpDRTGakcIgQ9fxaPBmzqv9IofptXnK Dx3Hw8H+HASEZZKLoGm+6er+o7sL8V2hzxeBHAzOQHH2q7Idpv1kANyTnXQtf5hvG6iu x19w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=cOtFRp3tT+XzxfQtCf8FddN72A2buzuK/r8cjXcC3nw=; b=aqGI0pRQXpZUO1kZj1ypj7BRgEgjaTjWv15Yxe1LJ4evr72Pf/W/eBTWz2vA1E5Z2T fjHvF9oQTGcPrFWHL7QCSHpSyHFPN/TP6GkWv1zbvbCxnSKN+kces752bH3KFo901dIV mILCye9CK+9YlbNKOcr6nknjiPYA5Qx2lzVy/auup09Km0e8F7CzMl+z9y0tuocS+G09 9rZ+XzyNLhF78st0U5HOHQFJrd9pY+0nuzAKShdxhnevT7hyFuNT4SPo/CjZfZQSWFol rm2odkWjUqS+F5uoR8hrzRuF6eoqRwCIHC2PIt+Bnnyi1Lfm852qasV3IKTHDjPVUl0U Qy8Q== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si5364685pgk.207.2019.04.04.00.24.29; Thu, 04 Apr 2019 00:24:44 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbfDDHXj (ORCPT + 99 others); Thu, 4 Apr 2019 03:23:39 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:33106 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726058AbfDDHXi (ORCPT ); Thu, 4 Apr 2019 03:23:38 -0400 Received: by mail-lf1-f65.google.com with SMTP id v14so1038472lfi.0 for ; Thu, 04 Apr 2019 00:23:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cOtFRp3tT+XzxfQtCf8FddN72A2buzuK/r8cjXcC3nw=; b=S5+iXLSKHd98eUKwxTNB+qyqLrs7gJg0L2ORk0wiZ4iIiWX7Gj3XtP4SvCkv58ymDL bqjnHN4utb4PNSQLrtqlPTT3lQFOPT5NazIV+fWCjtOM+jKYDkE+I1M9Cjo3LkVzYHkU gJJpO0h7hm2dKGpkvo5r79Ew8+s+bowOyafNXToVE0+b07/ZCdGjtwr/O8l6ymNl3Z2H Kfxn1cIvkveszmLPILI8yoPWHKYqzcmbyP1azYtVfL+pCwnQRpnrWhMGBzqfv7vSqBOk dBaGS86/l9tPmer4VSHe5BVYM+unCySB/BzHzbK2Ht8LkoCZ1Qb4Foa17pnleXXFs+nG QLTg== X-Gm-Message-State: APjAAAVLyt9BWXcX9F/kL/gYRVqAoTtTUBCMS/Hfvs323Z8ucLQBOawe UJ50InefPyTJ5Y953TEKeKc= X-Received: by 2002:ac2:5205:: with SMTP id a5mr2271569lfl.102.1554362616593; Thu, 04 Apr 2019 00:23:36 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id w22sm3744689ljd.42.2019.04.04.00.23.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 00:23:35 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hBwjA-0003SU-Gf; Thu, 04 Apr 2019 09:24:00 +0200 Date: Thu, 4 Apr 2019 09:24:00 +0200 From: Johan Hovold To: Rui Miguel Silva Cc: "Gustavo A. R. Silva" , Johan Hovold , Alex Elder , Greg Kroah-Hartman , greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: greybus: power_supply: Use struct_size() helper Message-ID: <20190404072400.GA29917@localhost> References: <20190403205801.GA19762@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 04, 2019 at 08:09:51AM +0100, Rui Miguel Silva wrote: > Hi Gustavo, > Thanks a lot for the patch. > > On Wed 03 Apr 2019 at 21:58, 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, in particular in > > the > > context in which this code is being used. > > > > So, replace code of the following form: > > > > sizeof(*resp) + props_count * sizeof(struct > > gb_power_supply_props_desc) > > > > with: > > > > struct_size(resp, props, props_count) > > > > This code was detected with the help of Coccinelle. > > > > Signed-off-by: Gustavo A. R. Silva > > What are the odds of 2 people changing same code in greybus in > the same day :). Well, I only noticed the bug in the current code, when reviewing Gustavo's diff. ;) Johan