[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZmYhc89_PXsKQqj8@google.com>
Date: Sun, 9 Jun 2024 14:41:07 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Erick Archer <erick.archer@...look.com>
Cc: Benjamin Gaignard <benjamin.gaignard@...labora.com>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Ricardo Ribalda <ribalda@...omium.org>,
Andrzej Pietrasiewicz <andrzej.p@...labora.com>,
Oliver Graute <oliver.graute@...oconnector.com>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
ye xingchen <ye.xingchen@....com.cn>,
Jason Gerecke <jason.gerecke@...om.com>,
Kees Cook <keescook@...omium.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Justin Stitt <justinstitt@...gle.com>,
Support Opensource <support.opensource@...semi.com>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] Input: touchscreen - use sizeof(*pointer) instead of
sizeof(type)
On Sat, Jun 08, 2024 at 04:34:49PM +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).
>
> The refactoring is mostly trivial except for "usbtouchscreen.c"
> file. Here, in the "mtouch_alloc" and "nexio_alloc" functions,
> it is necessary to use a variable with a predefined type instead
> of the "usbtouch->priv" variable (void * type). This way, the
> "sizeof" operator can now know the correct size. Moreover, we
> need to set the "usbtouch->priv" pointer after the memory
> allocation since now the "kmalloc" return value is not assigned
> directly.
>
> This patch has no effect on runtime behavior.
>
> Signed-off-by: Erick Archer <erick.archer@...look.com>
Applied, thank you.
--
Dmitry
Powered by blists - more mailing lists