Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp88169lqp; Sat, 8 Jun 2024 07:17:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVH4pA7SLT5zqxycFToCjtlJNtNwcxEquttSBjf26WSXy+zUy2gH3vRlln/kAsK40iK3HvvPxVrEaueHP27Bn8KonWZRnZGDL20hlGF4A== X-Google-Smtp-Source: AGHT+IFyIo5jlWX44dMDSxlkCLBQVSgW4hlIT4hvPF1J9kZ4wK5LewCbr4htQMgtl7OIHLEdZqEa X-Received: by 2002:a17:906:24d7:b0:a69:65a7:420d with SMTP id a640c23a62f3a-a6cd74bf8efmr399442466b.35.1717856220393; Sat, 08 Jun 2024 07:17:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717856220; cv=pass; d=google.com; s=arc-20160816; b=cUmskmGwLeTqaO4sQHIKNmArwmBs3FBheS7jIWQtI+HEsuBKfpyjQGtp/o6fMrZviE KGRjVaJWlfhYxUtokT3BY7+qwo59ipzSwsObxUisUXnsJEBf6eTi3xlw6R+NXPQbLAjT 7P85qq9g2l2WSRi73TwfoAVui9EJ1sm3967zEQMAmDXsCWbma1qzHY2XmcdJGm+kUKJi aTZo3Yu3kEOPpm6ZSarP24+CXOEG9BXMDQAQ3dSJ033lVCbE/njmDCj02DIyW0kaJweT 1XmKRhFIYGc6edEDuSgmvzEuyCzJ5d6wV9nhRKzI8yDZffrc+GDfX77ZuK8qqoDHSzJr vtFQ== 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 :subject:cc:to:from:date:dkim-signature; bh=d0KuGSP2pxB6EP1lFe96DAeE8aSGKgOrDLQpnLpGdjA=; fh=w9aRR1ar/jCG09W4H4hHuap4TfHJFSOneq30RVQsJQs=; b=k33RzQvoqBabCRTMj9tZ/+J2jkd7zkB05Vk81yHuhEDjc4RbPEHMMrygnqgsK4P5HY F1hSuZca55TrXWEI8e4ObrnlrttmWiiaKrKp3rYYJ8QSBfGoXCouiJNtbBIpSmdlQzjx aUi0cWwbemuH/DpxoZUFoyA3RuDXw5zpPfYgizidDRTWsRTwVnBffQmVPgWalYYdtUwx 0xeYc3egQzOz00fI4vdCJdEkHsGMKy+X2gaOCWoAdF1iRy4wT4nS35utsJPnhua1+R0H DxsQO4P9jq3vBlYwJI9I3w60fpqCXKR8HeFktDnCRDtaWbiykSrPpY/kuhRpas1cy/rQ SuAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R+CEJSDl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c80582022si283213766b.81.2024.06.08.07.17.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 07:17:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R+CEJSDl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 219DE1F21D25 for ; Sat, 8 Jun 2024 14:17:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 75F3F17A936; Sat, 8 Jun 2024 14:16:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R+CEJSDl" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8C8C7179652; Sat, 8 Jun 2024 14:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717856212; cv=none; b=ifiZBL9ik3s2EW3TN5dmwcmpjCFbA3ef9NpgqQBhULe3HqE1S4urQFdI98102qWpkTJmW/HFoft0CYGZ5DLj7XW8faUhohh3cQsSXcwuQJZsEcFDEYyNh0HWdz1emX6OrRVUYt7eq8Jc1pAA8ADfjawLUKUATsPwWxgxdAG3eAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717856212; c=relaxed/simple; bh=Y0RqWg41gTp2+bnmNIZlUVnvMEc4erjUmvjDN4eKdCQ=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X2oZ9Z03/ILCU3o3obIopnnmUpCDoegIYLYyuCVWldGMXRcwiXL5Fo1IydVe92FN5Ttmht7a4leRkW5yMoLzWGU+LBGkbf7HARY+LOAdDPK/05gT4FdQPChG04knDJRpVo8ZlyIWIcJhomFdLBxC4gG/siox/oouCiPCdzm6Qgk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R+CEJSDl; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD4D6C2BD11; Sat, 8 Jun 2024 14:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717856212; bh=Y0RqWg41gTp2+bnmNIZlUVnvMEc4erjUmvjDN4eKdCQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=R+CEJSDl6MsJ2ZOkktECryQlDO+kMpVVhp5WK9E0lLLMGwVP5ISrbF3BTecnM8s9u roa6bx7iTr3BjcPROVhdGvEsy+PnW6Tw9Gj1QLPxlxU6KS45Y5BYtHfwyLEJ69wKJ1 wGAc2WADfNftSNQH3g8ZPkHq1fK78fkIsWu26q7Vx05iLcBjhbO7jYFeKfmNkenNJv CDpWV8HDmlGAySDgtC1QudXt2SkmeAnvs/KblwB1cgC1aEfAYue7wUSPhSbHUCiY6l jVf2K7Dz0f61NyOwNmeBC8vl3mMPEZyUpms7wd8UQLWnMLqgGKrtdtTdt2A7ZmbxuZ XnVuzUjpTJ53Q== Date: Sat, 8 Jun 2024 15:16:43 +0100 From: Jonathan Cameron To: Erick Archer Cc: Lars-Peter Clausen , Kees Cook , "Gustavo A. R. Silva" , Justin Stitt , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] iio: event: use sizeof(*pointer) instead of sizeof(type) Message-ID: <20240608151643.5f82e10d@jic23-huawei> In-Reply-To: References: X-Mailer: Claws Mail 4.2.0 (GTK 3.24.42; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 2 Jun 2024 19:23:54 +0200 Erick Archer wrote: > It is preferred to use sizeof(*pointer) instead of sizeof(type) > due to the type of the variable can change and one needs not > change the former (unlike the latter). At the same time refactor > the NULL comparison. > > This patch has no effect on runtime behavior. > > Signed-off-by: Erick Archer Applied. > --- > drivers/iio/industrialio-event.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c > index 910c1f14abd5..b99bfeff7d37 100644 > --- a/drivers/iio/industrialio-event.c > +++ b/drivers/iio/industrialio-event.c > @@ -572,8 +572,8 @@ int iio_device_register_eventset(struct iio_dev *indio_dev) > iio_check_for_dynamic_events(indio_dev))) > return 0; > > - ev_int = kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL); > - if (ev_int == NULL) > + ev_int = kzalloc(sizeof(*ev_int), GFP_KERNEL); > + if (!ev_int) > return -ENOMEM; > > iio_dev_opaque->event_interface = ev_int;