lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c24481d-dfdf-4923-9629-3f6b074c27da@kernel.org>
Date: Thu, 7 Aug 2025 15:18:19 +0200
From: Hans Verkuil <hverkuil+cisco@...nel.org>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: Jacopo Mondi <jacopo.mondi@...asonboard.com>,
 Mauro Carvalho Chehab <mchehab@...nel.org>, Devarsh Thakkar
 <devarsht@...com>, Benoit Parrot <bparrot@...com>,
 Hans Verkuil <hverkuil@...nel.org>, Mike Isely <isely@...ox.com>,
 Hans de Goede <hansg@...nel.org>,
 Parthiban Veerasooran <parthiban.veerasooran@...rochip.com>,
 Christian Gromm <christian.gromm@...rochip.com>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Alex Shi
 <alexs@...nel.org>, Yanteng Si <si.yanteng@...ux.dev>,
 Dongliang Mu <dzm91@...t.edu.cn>, Jonathan Corbet <corbet@....net>,
 Tomasz Figa <tfiga@...omium.org>, Marek Szyprowski
 <m.szyprowski@...sung.com>, Andy Walls <awalls@...metrocast.net>,
 Michael Tretter <m.tretter@...gutronix.de>,
 Pengutronix Kernel Team <kernel@...gutronix.de>,
 Bin Liu <bin.liu@...iatek.com>, Matthias Brugger <matthias.bgg@...il.com>,
 AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
 Dmitry Osipenko <digetx@...il.com>, Thierry Reding
 <thierry.reding@...il.com>, Jonathan Hunter <jonathanh@...dia.com>,
 Mirela Rabulea <mirela.rabulea@....com>, Shawn Guo <shawnguo@...nel.org>,
 Sascha Hauer <s.hauer@...gutronix.de>, Fabio Estevam <festevam@...il.com>,
 Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
 Michal Simek <michal.simek@....com>, Ming Qian <ming.qian@....com>,
 Zhou Peng <eagle.zhou@....com>, Xavier Roumegue
 <xavier.roumegue@....nxp.com>, Philipp Zabel <p.zabel@...gutronix.de>,
 Vikash Garodia <quic_vgarodia@...cinc.com>,
 Dikshita Agarwal <quic_dikshita@...cinc.com>,
 Abhinav Kumar <abhinav.kumar@...ux.dev>,
 Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
 Sylwester Nawrocki <sylvester.nawrocki@...il.com>,
 Jernej Skrabec <jernej.skrabec@...il.com>, Chen-Yu Tsai <wens@...e.org>,
 Samuel Holland <samuel@...lland.org>,
 Daniel Almeida <daniel.almeida@...labora.com>,
 Neil Armstrong <neil.armstrong@...aro.org>,
 Kevin Hilman <khilman@...libre.com>, Jerome Brunet <jbrunet@...libre.com>,
 Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
 Nas Chung <nas.chung@...psnmedia.com>,
 Jackson Lee <jackson.lee@...psnmedia.com>,
 Minghsiu Tsai <minghsiu.tsai@...iatek.com>,
 Houlong Wei <houlong.wei@...iatek.com>,
 Andrew-CT Chen <andrew-ct.chen@...iatek.com>,
 Tiffany Lin <tiffany.lin@...iatek.com>,
 Yunfei Dong <yunfei.dong@...iatek.com>,
 Geert Uytterhoeven <geert+renesas@...der.be>,
 Magnus Damm <magnus.damm@...il.com>,
 Mikhail Ulyanov <mikhail.ulyanov@...entembedded.com>,
 Jacob Chen <jacob-chen@...wrt.com>,
 Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
 Heiko Stuebner <heiko@...ech.de>,
 Detlev Casanova <detlev.casanova@...labora.com>,
 Krzysztof Kozlowski <krzk@...nel.org>, Alim Akhtar
 <alim.akhtar@...sung.com>, Sylwester Nawrocki <s.nawrocki@...sung.com>,
 Łukasz Stelmach <l.stelmach@...sung.com>,
 Andrzej Pietrasiewicz <andrzejtp2010@...il.com>,
 Jacek Anaszewski <jacek.anaszewski@...il.com>,
 Andrzej Hajda <andrzej.hajda@...el.com>,
 Fabien Dessenne <fabien.dessenne@...s.st.com>,
 Hugues Fruchet <hugues.fruchet@...s.st.com>,
 Jean-Christophe Trotin <jean-christophe.trotin@...s.st.com>,
 Maxime Coquelin <mcoquelin.stm32@...il.com>,
 Alexandre Torgue <alexandre.torgue@...s.st.com>,
 Nicolas Dufresne <nicolas.dufresne@...labora.com>,
 Benjamin Gaignard <benjamin.gaignard@...labora.com>,
 Steve Longerbeam <slongerbeam@...il.com>, Maxime Ripard
 <mripard@...nel.org>, Paul Kocialkowski <paulk@...-base.io>,
 Niklas Söderlund <niklas.soderlund@...natech.se>,
 Robert Foss <rfoss@...nel.org>, Todor Tomov <todor.too@...il.com>,
 Vladimir Zapolskiy <vladimir.zapolskiy@...aro.org>,
 Corentin Labbe <clabbe@...libre.com>,
 Sakari Ailus <sakari.ailus@...ux.intel.com>,
 Bingbu Cao <bingbu.cao@...el.com>, Tianshu Qiu <tian.shu.qiu@...el.com>,
 Stanislaw Gruszka <stanislaw.gruszka@...ux.intel.com>,
 linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-staging@...ts.linux.dev, linux-doc@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org,
 linux-tegra@...r.kernel.org, imx@...ts.linux.dev,
 linux-renesas-soc@...r.kernel.org, linux-arm-msm@...r.kernel.org,
 linux-samsung-soc@...r.kernel.org, linux-sunxi@...ts.linux.dev,
 linux-usb@...r.kernel.org, linux-amlogic@...ts.infradead.org,
 linux-rockchip@...ts.infradead.org,
 linux-stm32@...md-mailman.stormreply.com, mjpeg-users@...ts.sourceforge.net
Subject: Re: [PATCH 58/65] media: zoran: Remove access to __fh

On 8/7/25 14:31, Laurent Pinchart wrote:
> On Thu, Aug 07, 2025 at 08:58:01AM +0200, Hans Verkuil wrote:
>> On 02/08/2025 11:23, Jacopo Mondi wrote:
>>> The __fh parameter is assigned to an unsued variable. Remove it
>>> and remove the unused struct zoran_fh type.
>>>
>>> Signed-off-by: Jacopo Mondi <jacopo.mondi@...asonboard.com>
>>> ---
>>>  drivers/media/pci/zoran/zoran.h        | 6 ------
>>>  drivers/media/pci/zoran/zoran_driver.c | 3 +--
>>>  2 files changed, 1 insertion(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/media/pci/zoran/zoran.h b/drivers/media/pci/zoran/zoran.h
>>> index 1cd990468d3de9db8b14b72483972041c57bfee2..d05e222b392156bf1b3b4c83c6591db642c3c377 100644
>>> --- a/drivers/media/pci/zoran/zoran.h
>>> +++ b/drivers/media/pci/zoran/zoran.h
>>> @@ -154,12 +154,6 @@ struct zoran_jpg_settings {
>>>  
>>>  struct zoran;
>>>  
>>> -/* zoran_fh contains per-open() settings */
>>> -struct zoran_fh {
>>> -	struct v4l2_fh fh;
>>> -	struct zoran *zr;
>>> -};
>>> -
>>>  struct card_info {
>>>  	enum card_type type;
>>>  	char name[32];
>>> diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c
>>> index f42f596d3e6295e31e3b33cd83c5f7243911bd30..ec7fc1da4cc02f5a344cb49bb9a783c41c758195 100644
>>> --- a/drivers/media/pci/zoran/zoran_driver.c
>>> +++ b/drivers/media/pci/zoran/zoran_driver.c
>>> @@ -511,12 +511,11 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
>>
>> This driver uses __fh as the name for the second argument of the ioctl
>> callbacks. Can you take this opportunity to rename it to either 'fh' or 'priv'?
> 
> It's a bit of yak shaving, but not too difficult so it will be addressed
> in the next version (Jacopo already wrote the patches, thanks).
> 
>> Generally it's not a good idea to prefix variables with __ for no good reason.
>>
>> Grepping for __fh also shows two other drivers:
>>
>> drivers/media/platform/chips-media/coda/coda-common.c:#define fh_to_ctx(__fh)   container_of(__fh, struct coda_ctx, fh)
>> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h:#define fh_to_ctx(__fh) container_of(__fh, struct s5p_mfc_ctx, fh)
>>
>> I think it is a good idea to rename __fh to fh there as well.
> 
> That can't be done, otherwise things like
> 
> #define fh_to_ctx(fh)	container_of(fh, struct coda_ctx, fh)
> 
> static inline struct coda_ctx *file_to_ctx(struct file *filp)
> {
> 	return fh_to_ctx(file_to_v4l2_fh(filp));
> }
> 
> will expand in the file_to_ctx() function to
> 
> 	return container_of(file_to_v4l2_fh(filp), struct coda_ctx, file_to_v4l2_fh(filp))

If the fh_to_ctx #define is changed to a static inline, then there is no problem.

That said, it is overkill.

Regards,

	Hans

> 
> We could rename the __fh argument to vfh or v4l2fh, but I think __fh is
> equally good there. It's just the macro argument name.
> 
>>>  			       struct v4l2_format *fmt)
>>>  {
>>>  	struct zoran *zr = video_drvdata(file);
>>> -	struct zoran_fh *fh = __fh;
>>>  	int i;
>>>  	int res = 0;
>>>  
>>>  	if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
>>> -		return zoran_s_fmt_vid_out(file, fh, fmt);
>>> +		return zoran_s_fmt_vid_out(file, __fh, fmt);
>>>  
>>>  	for (i = 0; i < NUM_FORMATS; i++)
>>>  		if (fmt->fmt.pix.pixelformat == zoran_formats[i].fourcc)
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ