Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1401881ybh; Thu, 23 Jul 2020 08:03:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwChZf5ED9r2I2d5e7YtvoaXSjUOjhtItdVHciXc9ecSbno+sD80BhuTiDLUPbC+dEzKw0F X-Received: by 2002:aa7:c398:: with SMTP id k24mr4449447edq.95.1595516620999; Thu, 23 Jul 2020 08:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595516620; cv=none; d=google.com; s=arc-20160816; b=OLCu9xZUToVPkuLJgRSUh0Hc3JNxwGaXn48qPO/03sGORPt41QsGNIRk+qn+FIkeg+ rC1DwJs5MPlbWYFlvfYPYhyD1HOwdZW6CNdrKH2Qq3q7YYWSvRygpFJOtW06OsDVVUaj qnF7CfcgVvAG10QFnD+L5woR3sICQkLrrgsjt63p4bSzDg3N8ddLLSXS2K5WlSvt3DqS o3HzrSXg1UwyoDhazKRBRiyC1GeAkcECMe5E2NI7HZ8poWHsGVJEu6Rfx2IKl7VkxZ81 lCbp3JSsK5xXZ/CMlvwP8SpkVQtbap1pjf1Jt1AoKNLMDO2Ae6QZd9vPF2uXnFa6SIk4 6z/A== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=0znpD67sqkVZAtsZ7lpXX04KynJInPo9KPqskvJAQTY=; b=AQEbuGbI5S1q8aXbO1uyh46yyKLmH72NadcJ7MPCGjpBaFRAzOfbADeFSlcOrh92MJ Tio3UQP5L/WpEuMXZamd4occeI04Rz4fPnalmdVTxAxE9w8carD56DGm+F3o59+Z6qak H987U8IG9819QRKkc0IfsAO5J0sqjQ4FF/ZMVU9nSXEcZLbN1sntSGF0lmo4sQwACn6m rbhm+JeE3APJpgYFz6MTvdQBaBH1J6DS59Vj9ABqOlLs0Av6hV+ScgY5ZXZaddebWlvT SLLnxUkBoqLUjGLVFNx83tTkcf4O4W2jErwd63JpVUX1IjQWunQzgRbgCiCRJqO3/Mht bQrw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si1235791edf.185.2020.07.23.08.03.17; Thu, 23 Jul 2020 08:03:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729548AbgGWO74 (ORCPT + 99 others); Thu, 23 Jul 2020 10:59:56 -0400 Received: from mga09.intel.com ([134.134.136.24]:50088 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729516AbgGWO7u (ORCPT ); Thu, 23 Jul 2020 10:59:50 -0400 IronPort-SDR: 7vzeljEVqcEpeGUds1RIMls+elW+Q3XCZtI2QbNIkVCNglwM+xrVpxigK0af9OmJzHUCodPGrK P2RvJSi8tPRg== X-IronPort-AV: E=McAfee;i="6000,8403,9690"; a="151839039" X-IronPort-AV: E=Sophos;i="5.75,386,1589266800"; d="scan'208";a="151839039" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 07:59:49 -0700 IronPort-SDR: LgnjdUVQexeR+PkGRmSkul40LHMRb1AI4AlvfpZuNfKRslOSybQtINI8gmlF7Gpin2bpEQe6WX pRv6rHHDz6WQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,386,1589266800"; d="scan'208";a="311051223" Received: from twinkler-lnx.jer.intel.com ([10.12.91.138]) by fmsmga004.fm.intel.com with ESMTP; 23 Jul 2020 07:59:47 -0700 From: Tomas Winkler To: Greg Kroah-Hartman Cc: Alexander Usyskin , linux-kernel@vger.kernel.org, Tomas Winkler , "Gustavo A . R . Silva" , Arnd Bergmann Subject: [char-misc-next 5/6] mei: hw: use sizeof of variable instead of struct type Date: Thu, 23 Jul 2020 17:59:26 +0300 Message-Id: <20200723145927.882743-6-tomas.winkler@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200723145927.882743-1-tomas.winkler@intel.com> References: <20200723145927.882743-1-tomas.winkler@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.25.4