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] [day] [month] [year] [list]
Message-ID: <8c685f16-8f49-42ab-ab1b-0fa0804d65f0@collabora.com>
Date: Fri, 7 Mar 2025 13:31:13 +0300
From: Dmitry Osipenko <dmitry.osipenko@...labora.com>
To: Arnd Bergmann <arnd@...nel.org>,
 Shreeya Patel <shreeya.patel@...labora.com>,
 Mauro Carvalho Chehab <mchehab@...nel.org>,
 Dingxian Wen <shawn.wen@...k-chips.com>, Hans Verkuil <hverkuil@...all.nl>
Cc: Arnd Bergmann <arnd@...db.de>, linux-media@...r.kernel.org,
 kernel@...labora.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: platform: synopsys: use div_u64() for 64-bit
 division

On 3/7/25 13:23, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> One open-coded division causes a link failure on 32-bit architectures:
> 
> ld.lld-21: error: undefined symbol: __aeabi_uldivmod
>>>> referenced by snps_hdmirx.c
>>>>               drivers/media/platform/synopsys/hdmirx/snps_hdmirx.o:(hdmirx_query_dv_timings) in archive vmlinux.a
> 
> Another one uses do_div() with a temporary variable.
> 
> Change both to use div_u64() to avoid the link failure and improve
> readability.
> 
> Fixes: 7b59b132ad43 ("media: platform: synopsys: Add support for HDMI input driver")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> index 4ffc86ad6c35..438536d88c7f 100644
> --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> @@ -296,7 +296,7 @@ static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev,
>  	hfp = htotal - hact - hs - hbp;
>  	vfp = vtotal - vact - vs - vbp;
>  
> -	fps = (bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal);
> +	fps = div_u64(bt->pixelclock + (htotal * vtotal) / 2, htotal * vtotal);
>  	bt->width = hact;
>  	bt->height = vact;
>  	bt->hfrontporch = hfp;
> @@ -396,7 +396,7 @@ static int hdmirx_get_detected_timings(struct snps_hdmirx_dev *hdmirx_dev,
>  	u32 val, tmdsqpclk_freq, pix_clk;
>  	unsigned int num_retries = 0;
>  	u32 field_type, deframer_st;
> -	u64 tmp_data, tmds_clk;
> +	u64 tmds_clk;
>  	bool is_dvi_mode;
>  	int ret;
>  
> @@ -418,9 +418,7 @@ static int hdmirx_get_detected_timings(struct snps_hdmirx_dev *hdmirx_dev,
>  
>  	tmdsqpclk_freq = hdmirx_readl(hdmirx_dev, CMU_TMDSQPCLK_FREQ);
>  	tmds_clk = tmdsqpclk_freq * 4 * 1000;
> -	tmp_data = tmds_clk * 24;
> -	do_div(tmp_data, hdmirx_dev->color_depth);
> -	pix_clk = tmp_data;
> +	pix_clk = div_u64(tmds_clk * 24, hdmirx_dev->color_depth);
>  	bt->pixelclock = pix_clk;
>  
>  	if (hdmirx_dev->pix_fmt == HDMIRX_YUV420)

Hi, thanks for the fix! Hans already merged a similar patch [1].

[1]
https://patchwork.linuxtv.org/project/linux-media/patch/20250306-synopsys-hdmirx-fix-64-div-v1-1-dd5ff38bba5e@kernel.org/

-- 
Best regards,
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ