Message ID | 20240212094618.344921-4-sakari.ailus@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-61258-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2397365dyd; Mon, 12 Feb 2024 04:36:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVIZL3iFyfmK72FiIcLwVSG45B0S+u9IJ83kKlzrOVBc4WU/NiCL7P08IpFaGZegjvM7S3pRT+qUjTb+NoZffwcmvfWYQ== X-Google-Smtp-Source: AGHT+IH1vnk1E+BWqMmufjvWo0DOCAvjkM0KLM3vww88wSnG0d3wYEOjvCAUf8FSo8tMCLfDTej+ X-Received: by 2002:a05:6a21:670f:b0:19e:a465:99b with SMTP id wh15-20020a056a21670f00b0019ea465099bmr4610069pzb.28.1707741380515; Mon, 12 Feb 2024 04:36:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707741380; cv=pass; d=google.com; s=arc-20160816; b=OGm/e76NlPbkkkw19HQzfc6WTsid2mteabVzKK8UIiXId69Zhcl6ZzQQEcIShfnex9 lZpq8FxxvOLd1IkoaAbaS6pnqOnmOU+vOYWkI/wujCAUS2XIMDVnWPrPCHpk7+g9Ffyj cvk5ed88/6WNgJHyZICbNGP6kuiMsxm2/H1DLJEQ+0K1e/BHxwaYKwJRs3UrTUK9NKva h6K+JNL4Ua8r6VslvNjaw0kSQF9Blnxp4PccIyv4YatVSJfKTpdHixpKc91YFQ8qytPO AmrgYPGJJvhmzGvPC7G5blQ+SKdS5nNYlB9+8Zdw/3/gE8glre+loyhnnbTNzruEzBjh MQzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Ct8gFNGvPBzS+DPaw1nMUHK6yp4/uwrJiNiZGeNJ4ng=; fh=8Y4QtllbrpxEYwzePpv+6nuZUGGrJSYD49XVeyG0QUc=; b=gdL3WXxR7ti+2yvlNzpVxH8YBCj5Os0BJ5y+ZdS5hi3T5AJ7bYkkw2uWAfDJK7vBCO mQhDnEvxTecunfY85F2iPZCRtBYtmZnKU8CgASo1ij8YHscCYz4eDXNPVjN9NQaVfCEn VZp8hBfFMBH4XqZL8H7XbQjqw+eiqey5MK4N5ERwY5GCuWFhmtb79XJcEe9/4qSCFD14 03Y1RsfovpbKP+7AnBWIBGMU7RG8VqtaMKlJEWl7qpOHKmdqwI+h7Zpv0K5eQVpY12zX /FrToaIKWR6ULH+Wmv55rlt3234cAdE1D1EXBenLjN6MosRnsn28TYLNOIz8jz2a5AzZ du0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I4qcL07S; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61258-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61258-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCWhpb60/XCRV2okqetINZMGOd0BKY3XcnG4I4zHQ3B/yn7ctiaeP3t3Ea3WHG9RzoBcECq9x1W2WTRI2xZITZiILJEsjw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id pf3-20020a17090b1d8300b00290191c241bsi233807pjb.19.2024.02.12.04.36.20 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 04:36:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61258-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I4qcL07S; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61258-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61258-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 42377285127 for <ouuuleilei@gmail.com>; Mon, 12 Feb 2024 09:47:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 264771BC44; Mon, 12 Feb 2024 09:46:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="I4qcL07S" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61DB917BB6 for <linux-kernel@vger.kernel.org>; Mon, 12 Feb 2024 09:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707731190; cv=none; b=OwMvDXVUB5wSvVdJw+zlxzSL3vgpD/rNjr1ZeB+ZconpE7NhLyS5ezoud0CGSUrrQ85fk1pHsNIfiQEV6pA1huQ3JUlZGocuGo1/PQiWOe/Yi/f5wmLPYqMeeZ3q7lwnpsVaaQInMP5oRlwAKaIW0Bk43c3N50hcGWV2AzeducU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707731190; c=relaxed/simple; bh=GCBoBAoo/8mj/fqY6112iWUXqL2JJlgA0ytaI1YG8K0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f+zYlJJgUPeqEPqpOSIu6NFrXTmaABiZIBX3KfqPPUMrOTeK2EF1aBPsbNsFd2TwXjwmMUC933rcJTPSf+Eo3zxQccLjXUH0Nrhxwk8j5iccSIw3yK+TGC/WrL6km01t/sQAuNkjHS4pi/VoxOg9JQ9Pl9Tim2yAqy1JFQwffvk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=I4qcL07S; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707731187; x=1739267187; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GCBoBAoo/8mj/fqY6112iWUXqL2JJlgA0ytaI1YG8K0=; b=I4qcL07SSs2H+16O4LTsa2ZkAbQK+hKp+VFNFUA4iRu3Oo5aKoFUfOtJ 4WndixBoZisZMrlZQtPCq/DvN8v+Yqjns1dQRSG6AYxsF7XMP11oJA3Xf mrHN/mdtGFNyO1d1/sfTzOdA/wqhhMRMZ19AINE3qJ/iPkK+gjzkYi3eA zFAwyIXNNWM9ZZm20BA/YgCR6T4oPGrObWr0Kgl7XedfriygpRYvYT3gD CPSWKQSz36Z5C3lXtjLT1BlMfmPP5C0YuMXjxHkLKlpB3u9T/KiEpzhd/ F7zoDqJc3ZlP8woJSnFdfFsdMP11fpGr6lDZX+IHumh/cW4cD4KCI8L/S g==; X-IronPort-AV: E=McAfee;i="6600,9927,10981"; a="12335884" X-IronPort-AV: E=Sophos;i="6.05,262,1701158400"; d="scan'208";a="12335884" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 01:46:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,262,1701158400"; d="scan'208";a="2502543" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 01:46:24 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 758FC11FB0F; Mon, 12 Feb 2024 11:46:21 +0200 (EET) From: Sakari Ailus <sakari.ailus@linux.intel.com> To: linux-kernel@vger.kernel.org Cc: Hans de Goede <hdegoede@redhat.com>, Tomas Winkler <tomas.winkler@intel.com>, Wentong Wu <wentong.wu@intel.com>, Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Subject: [PATCH 3/3] mei: vsc: Assign pinfo fields in variable declaration Date: Mon, 12 Feb 2024 11:46:18 +0200 Message-Id: <20240212094618.344921-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240212094618.344921-1-sakari.ailus@linux.intel.com> References: <20240212094618.344921-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790686940715468372 X-GMAIL-MSGID: 1790696625582091608 |
Series |
MEI VSC fixes and cleanups
|
|
Commit Message
Sakari Ailus
Feb. 12, 2024, 9:46 a.m. UTC
Assign all possible fields of pinfo in variable declaration, instead of
just zeroing it there.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/misc/mei/vsc-tp.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
Comments
Hi Greg, Thanks for the review. On Mon, Feb 12, 2024 at 11:02:04AM +0100, Greg Kroah-Hartman wrote: > On Mon, Feb 12, 2024 at 11:46:18AM +0200, Sakari Ailus wrote: > > Assign all possible fields of pinfo in variable declaration, instead of > > just zeroing it there. > > > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > > --- > > drivers/misc/mei/vsc-tp.c | 16 ++++++++-------- > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/misc/mei/vsc-tp.c b/drivers/misc/mei/vsc-tp.c > > index 200af14490d7..1eda2860f63b 100644 > > --- a/drivers/misc/mei/vsc-tp.c > > +++ b/drivers/misc/mei/vsc-tp.c > > @@ -447,11 +447,16 @@ static int vsc_tp_match_any(struct acpi_device *adev, void *data) > > > > static int vsc_tp_probe(struct spi_device *spi) > > { > > - struct platform_device_info pinfo = { 0 }; > > + struct vsc_tp *tp; > > + struct platform_device_info pinfo = { > > + .name = "intel_vsc", > > + .data = &tp, > > + .size_data = sizeof(tp), > > + .id = PLATFORM_DEVID_NONE, > > + }; > > But now you have potential stack data in the structure for the fields > that you aren't assigning here, right? Is that acceptable, or will it > leak somewhere? Hmm. I'm not quite sure what you mean. The patch changes where the fields are assigned but the variable is only used when the assignment is done in any case, so this doesn't change anything. > > This is why we generally do not do this type of style. So unless you > are fixing an issue here, please don't do it. The only caveat in initialising a struct is that the possible holes due to ABI aren't initialised, which generally is a concern with UAPI or network (i.e. not here, and the patch doesn't change that anyway).
diff --git a/drivers/misc/mei/vsc-tp.c b/drivers/misc/mei/vsc-tp.c index 200af14490d7..1eda2860f63b 100644 --- a/drivers/misc/mei/vsc-tp.c +++ b/drivers/misc/mei/vsc-tp.c @@ -447,11 +447,16 @@ static int vsc_tp_match_any(struct acpi_device *adev, void *data) static int vsc_tp_probe(struct spi_device *spi) { - struct platform_device_info pinfo = { 0 }; + struct vsc_tp *tp; + struct platform_device_info pinfo = { + .name = "intel_vsc", + .data = &tp, + .size_data = sizeof(tp), + .id = PLATFORM_DEVID_NONE, + }; struct device *dev = &spi->dev; struct platform_device *pdev; struct acpi_device *adev; - struct vsc_tp *tp; int ret; tp = devm_kzalloc(dev, sizeof(*tp), GFP_KERNEL); @@ -508,13 +513,8 @@ static int vsc_tp_probe(struct spi_device *spi) ret = -ENODEV; goto err_destroy_lock; } - pinfo.fwnode = acpi_fwnode_handle(adev); - - pinfo.name = "intel_vsc"; - pinfo.data = &tp; - pinfo.size_data = sizeof(tp); - pinfo.id = PLATFORM_DEVID_NONE; + pinfo.fwnode = acpi_fwnode_handle(adev); pdev = platform_device_register_full(&pinfo); if (IS_ERR(pdev)) { ret = PTR_ERR(pdev);