Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1477637ybh; Thu, 23 Jul 2020 09:49:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRoHrCebZlCoJNO9J9zV7AaCGOje2Yi6zRIfiiWzRzuPu4p8Uk5nvCZQGt2nZALNqXH+Lq X-Received: by 2002:aa7:db06:: with SMTP id t6mr5017052eds.369.1595522954826; Thu, 23 Jul 2020 09:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595522954; cv=none; d=google.com; s=arc-20160816; b=LyVq1YuOaeTkb6BofDJUBSxYjyqqtThsdqmtha2/pBOi9CcRMqRtQRvLvYlTq2lQ+Y X1Tkuxdn/wBeSJIZhal9bQPHPMNOdPngLUJ/nJ0Z9CtxHW+bU/Q35z7EqPh9GDwbyFJh zN68M/Z35G8zClRDClPxQ4w6fcptBZDcmlRvaFwusoPovhmIweVDjs6Awg2s7XzK6U95 dUL06Ls4nYxXie7DZciZl+zRFDALhYs+7AHotEtuCvzzdznhosZ1UDRn9xVeGs4TuN3D MY7HQsjNKUJ6hAxiapogg2oiwtwq89atRD4peltyve9zTbYDva4nuQkTrsfFbmOzBEYK 9jtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=6AWZIibxr7YfSHGUsrhBZ16GS4ho7qtbLDrL7MZ8LPE=; b=Lt0DKcV54d1IAC0/pEro0JVcJo1Nq4l4+cEyoeit1Dni/wxnKqiyaxxDnDizVk3Frs AeJF4WezTXNFoqd8DhM0vR11g/V7b9tQfvdr8AGd0y4k7Jt0GF1/NmmEVQKOGrUZNMS5 mij3m/Se8BKM5aN308rP+odo/wObV/McYXyTMCT5zfosn68XsebKnf+oXDpOhljk4w+L Lkhvpt73RVEJL9WSFs7QQY4LOwNAYHyxJQRB6osV5mKjdEOlB1RZWa7wUoegLY/S4EpD uibkVmMymMfwC6f2g7kewTrmHihQ80TeFynmNLghgiRjYJRZlGduLdayxIKs756qhOi+ cHJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@embeddedor.com header.s=default header.b=H07yZtRe; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si2366260ejt.197.2020.07.23.09.48.51; Thu, 23 Jul 2020 09:49:14 -0700 (PDT) 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=fail header.i=@embeddedor.com header.s=default header.b=H07yZtRe; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729813AbgGWQsN (ORCPT + 99 others); Thu, 23 Jul 2020 12:48:13 -0400 Received: from gateway20.websitewelcome.com ([192.185.52.45]:17872 "EHLO gateway20.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726621AbgGWQsM (ORCPT ); Thu, 23 Jul 2020 12:48:12 -0400 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway20.websitewelcome.com (Postfix) with ESMTP id E7C54400E0253 for ; Thu, 23 Jul 2020 10:25:55 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id yeNsjNwHGwgQAyeNsjOZXW; Thu, 23 Jul 2020 11:47:52 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=embeddedor.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6AWZIibxr7YfSHGUsrhBZ16GS4ho7qtbLDrL7MZ8LPE=; b=H07yZtRe+AklMPIUWXZ2gfV8xU uUdYeAuhccp+bu+KKppGW3snCHpZm2ujejRALV/tFkS9zvoo6FK3Rb476scmnuimr918rpMpwphzS JCIO0snDztLNFWuMCgqjWqSJeoV5j7PvaiAK8sS/MCzJHVfVWc6tQyEOr3xvD+T1iOX40WkTCaWSd oAjgdxvxD+9wCUYkgGXItOGYQVayAPFUTDr6dgmuhQdRVlqVhBomD4xEtAtgbeaUjB6UH2oA4mJFO ua8hcCBP5kM3StA0gUTLAbK8EWVEwoq0c4JzKQ+hkAxWisPR+NfHTRLRQmXwFOwJjxg6osqkgO9dx F75mRuNg==; Received: from [201.162.245.27] (port=42552 helo=[192.168.43.132]) by gator4166.hostgator.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jyeNs-003zoU-Eq; Thu, 23 Jul 2020 11:47:52 -0500 Subject: Re: [char-misc-next 5/6] mei: hw: use sizeof of variable instead of struct type To: Tomas Winkler , Greg Kroah-Hartman Cc: Alexander Usyskin , linux-kernel@vger.kernel.org, "Gustavo A . R . Silva" , Arnd Bergmann References: <20200723145927.882743-1-tomas.winkler@intel.com> <20200723145927.882743-6-tomas.winkler@intel.com> From: "Gustavo A. R. Silva" Autocrypt: addr=gustavo@embeddedor.com; keydata= xsFNBFssHAwBEADIy3ZoPq3z5UpsUknd2v+IQud4TMJnJLTeXgTf4biSDSrXn73JQgsISBwG 2Pm4wnOyEgYUyJd5tRWcIbsURAgei918mck3tugT7AQiTUN3/5aAzqe/4ApDUC+uWNkpNnSV tjOx1hBpla0ifywy4b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CWywcDAIbDAUJCWYBgAAKCRBHBbTLRwbbMdsZEACUjmsJx2CAY+QSUMebQRFjKavw XB/xE7fTt2ahuhHT8qQ/lWuRQedg4baInw9nhoPE+VenOzhGeGlsJ0Ys52sdXvUjUocKgUQq 6ekOHbcw919nO5L9J2ejMf/VC/quN3r3xijgRtmuuwZjmmi8ct24TpGeoBK4WrZGh/1hAYw4 ieARvKvgjXRstcEqM5thUNkOOIheud/VpY+48QcccPKbngy//zNJWKbRbeVnimua0OpqRXhC rEVm/xomeOvl1WK1BVO7z8DjSdEBGzbV76sPDJb/fw+y+VWrkEiddD/9CSfgfBNOb1p1jVnT 2mFgGneIWbU0zdDGhleI9UoQTr0e0b/7TU+Jo6TqwosP9nbk5hXw6uR5k5PF8ieyHVq3qatJ 9K1jPkBr8YWtI5uNwJJjTKIA1jHlj8McROroxMdI6qZ/wZ1ImuylpJuJwCDCORYf5kW61fcr HEDlIvGc371OOvw6ejF8ksX5+L2zwh43l/pKkSVGFpxtMV6d6J3eqwTafL86YJWH93PN+ZUh 6i6Rd2U/i8jH5WvzR57UeWxE4P8bQc0hNGrUsHQH6bpHV2lbuhDdqo+cM9ehGZEO3+gCDFmK rjspZjkJbB5Gadzvts5fcWGOXEvuT8uQSvl+vEL0g6vczsyPBtqoBLa9SNrSVtSixD1uOgyt AP7RWS474w== Message-ID: <3fa1faf1-40a8-7506-ea93-f266b0e45c86@embeddedor.com> Date: Thu, 23 Jul 2020 11:53:37 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200723145927.882743-6-tomas.winkler@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 201.162.245.27 X-Source-L: No X-Exim-ID: 1jyeNs-003zoU-Eq X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.43.132]) [201.162.245.27]:42552 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 10 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/23/20 09:59, Tomas Winkler wrote: > Use sizeof(*dev) + sizeof(*hw) instead of > sizeof(struct mei_device) + sizeof(struct mei_me_hw) > > There is a possibility of bug when variable type has changed but > corresponding struct passed to the sizeof has not. > > Cc: Gustavo A. R. Silva > Signed-off-by: Tomas Winkler Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo > --- > drivers/misc/mei/hw-me.c | 5 ++--- > drivers/misc/mei/hw-txe.c | 5 ++--- > 2 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c > index c51d3da8f333..7692b69abcb5 100644 > --- a/drivers/misc/mei/hw-me.c > +++ b/drivers/misc/mei/hw-me.c > @@ -1,6 +1,6 @@ > // SPDX-License-Identifier: GPL-2.0 > /* > - * Copyright (c) 2003-2019, Intel Corporation. All rights reserved. > + * Copyright (c) 2003-2020, Intel Corporation. All rights reserved. > * Intel Management Engine Interface (Intel MEI) Linux driver > */ > > @@ -1600,8 +1600,7 @@ struct mei_device *mei_me_dev_init(struct device *parent, > struct mei_me_hw *hw; > int i; > > - dev = devm_kzalloc(parent, sizeof(struct mei_device) + > - sizeof(struct mei_me_hw), GFP_KERNEL); > + dev = devm_kzalloc(parent, sizeof(*dev) + sizeof(*hw), GFP_KERNEL); > if (!dev) > return NULL; > > diff --git a/drivers/misc/mei/hw-txe.c b/drivers/misc/mei/hw-txe.c > index 785b260b3ae9..a4e854b9b9e6 100644 > --- a/drivers/misc/mei/hw-txe.c > +++ b/drivers/misc/mei/hw-txe.c > @@ -1,6 +1,6 @@ > // SPDX-License-Identifier: GPL-2.0 > /* > - * Copyright (c) 2013-2019, Intel Corporation. All rights reserved. > + * Copyright (c) 2013-2020, Intel Corporation. All rights reserved. > * Intel Management Engine Interface (Intel MEI) Linux driver > */ > > @@ -1201,8 +1201,7 @@ struct mei_device *mei_txe_dev_init(struct pci_dev *pdev) > struct mei_device *dev; > struct mei_txe_hw *hw; > > - dev = devm_kzalloc(&pdev->dev, sizeof(struct mei_device) + > - sizeof(struct mei_txe_hw), GFP_KERNEL); > + dev = devm_kzalloc(&pdev->dev, sizeof(*dev) + sizeof(*hw), GFP_KERNEL); > if (!dev) > return NULL; > >