From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R+CEJSDl" 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-iio@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;