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: <aV5rloYmYfLMkMKA@stanley.mountain>
Date: Wed, 7 Jan 2026 17:20:06 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Karthikey D Kadati <karthikey3608@...il.com>
Cc: Hans de Goede <hansg@...nel.org>,
	Mauro Carvalho Chehab <mchehab@...nel.org>,
	Sakari Ailus <sakari.ailus@...ux.intel.com>,
	linux-media@...r.kernel.org, linux-staging@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 RESEND v2 1/3] media: atomisp: replace shadow zoom
 structs with v4l2_rect

On Wed, Jan 07, 2026 at 07:18:42PM +0530, Karthikey D Kadati wrote:
> Remove custom atomisp_zoom_point and atomisp_zoom_region structs and
> 
> usage in favor of standard v4l2_rect within atomisp_dz_config.
> 
> This aligns the driver with V4L2 standards and removes unnecessary
> 
> custom types.
> 
> Also standardizes the internal ia_css_region struct members to match
> 
> V4L2 naming conventions (left, top, width, height) to facilitate the
> 
> bridge mapping.
> 
> Updates atomisp_cmd.c and sh_css_params.c to use the new member names
> 
> and ensures safe math using long long casts to prevent overflow during
> 
> resolution scaling.
> 

The commit message has extra new lines obviously.

> diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> index 327836372..4ed6b8aea 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> @@ -1764,15 +1764,13 @@ int atomisp_calculate_real_zoom_region(struct atomisp_sub_device *asd,
>  		return -EINVAL;
>  	}
>  
> -	if (dz_config->zoom_region.resolution.width
> -	    == asd->sensor_array_res.width
> -	    || dz_config->zoom_region.resolution.height
> -	    == asd->sensor_array_res.height) {
> +	if (dz_config->zoom_region.width == asd->sensor_array_res.width ||
> +	    dz_config->zoom_region.height == asd->sensor_array_res.height) {
>  		/*no need crop region*/
> -		dz_config->zoom_region.origin.x = 0;
> -		dz_config->zoom_region.origin.y = 0;
> -		dz_config->zoom_region.resolution.width = eff_res.width;
> -		dz_config->zoom_region.resolution.height = eff_res.height;
> +		dz_config->zoom_region.left = 0;
> +		dz_config->zoom_region.top = 0;
> +		dz_config->zoom_region.width = eff_res.width;
> +		dz_config->zoom_region.height = eff_res.height;
>  		return 0;
>  	}
>  
> @@ -1783,18 +1781,18 @@ int atomisp_calculate_real_zoom_region(struct atomisp_sub_device *asd,
>  	 */
>  
>  	if (!IS_ISP2401) {
> -		dz_config->zoom_region.origin.x = dz_config->zoom_region.origin.x
> -						  * eff_res.width
> -						  / asd->sensor_array_res.width;
> -		dz_config->zoom_region.origin.y = dz_config->zoom_region.origin.y
> -						  * eff_res.height
> -						  / asd->sensor_array_res.height;
> -		dz_config->zoom_region.resolution.width = dz_config->zoom_region.resolution.width
> -							  * eff_res.width
> -							  / asd->sensor_array_res.width;
> -		dz_config->zoom_region.resolution.height = dz_config->zoom_region.resolution.height
> -							  * eff_res.height
> -							  / asd->sensor_array_res.height;
> +		dz_config->zoom_region.left =
> +			(s32)((long long)dz_config->zoom_region.left *
> +			      eff_res.width / asd->sensor_array_res.width);
> +		dz_config->zoom_region.top =
> +			(s32)((long long)dz_config->zoom_region.top *
> +			      eff_res.height / asd->sensor_array_res.height);
> +		dz_config->zoom_region.width =
> +			(u32)((long long)dz_config->zoom_region.width *
> +			      eff_res.width / asd->sensor_array_res.width);
> +		dz_config->zoom_region.height =
> +			(u32)((long long)dz_config->zoom_region.height *
> +			      eff_res.height / asd->sensor_array_res.height);


Why do we need this new casting?  Is it a bugfix?

I don't love the casts to s32 and u32.  Those are unnecessary.  Also
width and height are s32 so why are we casting to u32?  Same comments
for the other casts later on.

There are more style changes than strictly necessary to just rename the
struct members.

regards,
dan carpenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ