Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2363529rdb; Mon, 12 Feb 2024 02:15:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU4pe0VMV8jz2vwTIfEr19CpkaQh3VIs7yIC0TObeK9kiRmPZmtLhbyYIhPrLGDS3Y8YZl7sQUL9/nmRaFUMKAHZZShEGVtlLN8soZtng== X-Google-Smtp-Source: AGHT+IE4I9jqK5vM+JTu3b+k3ScagXGth0gfpNGtlN8BdVVHQGQBZfV2AKObq5SQ/mizON6jlCry X-Received: by 2002:aa7:d9da:0:b0:561:d81b:d402 with SMTP id v26-20020aa7d9da000000b00561d81bd402mr66596eds.18.1707732902130; Mon, 12 Feb 2024 02:15:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707732902; cv=pass; d=google.com; s=arc-20160816; b=ctxGVwEMJEhaqXg2W+lS11RxasZuI4ElM+hHcEuzwaV4IoGuw7EeaaJpzLLPe/uGvV Mw3WXqwJcai8kwLmPWsCpPokj4lSftfowOC43YLQjSPyxEwYa/FaP5/T5hK4DmePlwYn fIXBUV5QE/L6TQ2lXS2ilmOEscS2VZumg55r7ZvnpLNX/2Y1XNyxHCyd5aZRq0sag73K CI9BuLybq6cYgJrGvDqKTTGV3bq9F/AqGTNdypOgUD/60hWrHabCKvXlTehX4jlI8iop SFAolq1UozQCftoABz/y1xEVnJJhWpxDT140E+/d0uMIUJRbopHkPaDlawNsDtJFgQzB +Log== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=G6CjnMK957IM+RCvtCLAx+cGU8Pb8iQvHeoRYF4Gt58=; fh=ngkMT1YsnlXsGYP4D3r2uLDPAyBFUin91fujsmnLqZE=; b=mX+1ItqdLv54042U048HuNk+tolGIqqVIa/NaUtgnYfIWioEF8I7HW6H4KEJUT2AKm qgPTRae8UpS3VIKytatT1PGAj4Vpt+dacMvuUFLmEpt9uRHsyC5jtHC4399tRaIauJ3b huFUQu+Lz+8PozMdBFQ6lyJTisCvgflhQuHl7S2hUHLE27Tw+YVaSGv11Iiq8Kuhx1Z9 V9btzmKzSDBDaYd9hZJK12N/kUrrrWmdju8ttoeryd2bPm2UQOLkgo9UMmKltLX5kBTy 2k1bUwQUEtxKD3N5Ihh4kLCpmEUeNROo4d6k7xY/0rxz8rjYWNeVGnN309iRruspSCzN YSwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=ZRN6ozgc; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=s1SxU89p; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-61288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de X-Forwarded-Encrypted: i=2; AJvYcCXO06+UrTN5mM8AgbRWp8RkdDOXWqC6M89k/vZPSulbT2vCYAjSuZrXaRduOCe9sP41Ojc5sM9v5+PRqyWzRBzx2PdaZB9QS66fOJjEwA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w25-20020aa7d299000000b0056149504777si2639057edq.438.2024.02.12.02.15.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 02:15:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=ZRN6ozgc; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=s1SxU89p; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-61288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de 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 am.mirrors.kernel.org (Postfix) with ESMTPS id DB74F1F2228B for ; Mon, 12 Feb 2024 10:15:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90E0617C6C; Mon, 12 Feb 2024 10:14:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="ZRN6ozgc"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="s1SxU89p" Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (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 E94CF5244 for ; Mon, 12 Feb 2024 10:14:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.26 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707732893; cv=none; b=mypHi00ZUhgkYCthr+LZm2FSW13G3ePtRjIiWoCe74RdrXWhI1ySOnDNk9VSbYHMIfCBkutOjHibH6i77lmw3l0oeeWRFrA86VZuIfnKNfG5huF3YILB3+6f6oZLq84OwrlM7rLVNUN/dqInP1TlBo8O4ZAJxGRayPcPVvUcJsk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707732893; c=relaxed/simple; bh=J/Kgk7VX3+VSNcQMqMb5LEduN+6QTHJfdTAZOt6yfA8=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=Xny+MF5fX7sbb6ZR2xHC1sZiyzyqQc7M1e5OvwUTDT8l7IXyeYY9WSv2l1FN+S69kGMO6ZSrkkCLLJqHGenqtJ5u3ERvR66K/U+PrjXIJrVFHxe5ACpytrmX4wescQiXKPAaR4QaKPJmQucMWKCMpt+yFpXvmWyj+ptW5FMP4Y0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=ZRN6ozgc; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=s1SxU89p; arc=none smtp.client-ip=66.111.4.26 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A7E595C0096; Mon, 12 Feb 2024 05:14:49 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 12 Feb 2024 05:14:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1707732889; x=1707819289; bh=G6CjnMK957 IM+RCvtCLAx+cGU8Pb8iQvHeoRYF4Gt58=; b=ZRN6ozgc7da8Hp6bwx7dNDKIUR arDYzFtVJHQIvDGtnZFpd+T9bN1R/eTSqIDT33lm6crGuGtqnlcVjBNBiMpfuVo/ A1v5vS4WESxjlCSMZQVr+mVs3kppd5TRMTuOraRtUNfMcbxgLi0XnRyLjuOKatHu NxRBke3fijhKK+vWHXV66cGV339RygNAOFeAbW7ip0b7gbQsYzrf15cSb+Zjz2vk gUaYBn5dZP5+8c2b0KUhOjsSxfE63PHUueRnRtSHWHkHsO0sEPIvmjs06YIN9mt9 nFwh1MBAQyITjHudMvXjWa1/bRRV34PLMO0TwtBw/4JBHdYZmoUPWofuSpNQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1707732889; x=1707819289; bh=G6CjnMK957IM+RCvtCLAx+cGU8Pb 8iQvHeoRYF4Gt58=; b=s1SxU89p+fDvqV0388Bhw6l7c8xzfqXQN01N65eys0FM 11A3pLBqI67ap+7BmkNdHYeIJPZF34ZN2ERA5I3TVaES09+ztCvtftyR9pMj7r2/ KJahuw13wb5NIMh2GGkiSpoXWIij4ikxxq1pQ4BxGD7hDflH/Rwi0vuYvZF+JT8a dVdxehEdg3C7wcaXvptMIX7vIOHzmtlVALBVNxIfK8BJDRCfCDcCzn8J1yRHnVCr BHBeKSATpjX+SNlm6pXuJNY3p10s/dhF7R8Ip4i5ooKrafiCCQloaBZe79rd1QKz HfuaMmr6uyer/llKZXjbmbkUli5L4kZ+gANMLifaCA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtth gvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedtkeet ffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrh hnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 51357B6008D; Mon, 12 Feb 2024 05:14:49 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-144-ge5821d614e-fm-20240125.002-ge5821d61 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: <2024021210-freeway-unblessed-d966@gregkh> References: <20240212094618.344921-1-sakari.ailus@linux.intel.com> <20240212094618.344921-4-sakari.ailus@linux.intel.com> <2024021210-freeway-unblessed-d966@gregkh> Date: Mon, 12 Feb 2024 11:14:29 +0100 From: "Arnd Bergmann" To: "Greg Kroah-Hartman" , "Sakari Ailus" Cc: linux-kernel@vger.kernel.org, "Hans de Goede" , "Tomas Winkler" , "Wentong Wu" Subject: Re: [PATCH 3/3] mei: vsc: Assign pinfo fields in variable declaration Content-Type: text/plain On Mon, Feb 12, 2024, at 11:02, 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 >> --- >> 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? > > 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. If you have any initializer, all named fields in the structure are zeroed. The only bits of the structure that may contain stack data are for padding between fields, but that doesn't actually change here from the previous version. The old version you have here just skips the named fields and otherwise would end up lookingn like struct platform_device_info pinfo = { .parent = 0, }; which is still a partial initializer and has the added problem of relying on a literal '0' as a NULL pointer. In modern compilers, one can write this as struct platform_device_info pinfo = {}, but Sakari's version looks best to me. Arnd