[PATCH v2] drm/i915/gt: Use kmemdup_array instead of kmemdup for multiple allocation

Andi Shyti andi.shyti at linux.intel.com
Tue Aug 20 11:08:24 UTC 2024


Hi,

On Tue, Aug 20, 2024 at 05:53:02PM +0800, Yu Jiaoliang wrote:
> Let the kememdup_array() take care about multiplication and possible
> overflows.
> 
> v2:
> - Change subject
> - Leave one blank line between the commit log and the tag section
> - Fix code alignment issue
> 
> Signed-off-by: Yu Jiaoliang <yujiaoliang at vivo.com>
> Reviewed-by: Jani Nikula <jani.nikula at intel.com>
> Reviewed-by: Andi Shyti <andi.shyti at linux.intel.com>

I didn't give you an explicit R-b, but that's fine, you can keep
it as I think the patch is fine.

> -		struct i915_wa *list = kmemdup_array(wal->list,
> -					       wal->count, sizeof(*list),
> -					       GFP_KERNEL);
> +		struct i915_wa *list = kmemdup_array(wal->list, wal->count,
> +											 sizeof(*list), GFP_KERNEL);

Do you see the indentation is off here? :-)

Please, run checkpatch.pl before sending the patch, as well.

Besides, what patch is this? Are you replacing kmemdup_array with
kmemdup_array? This v2 applies on your v1 while it should apply
on a clean drm-tip repository.

Thanks,
Andi

>  
>  		if (list) {
>  			kfree(wal->list);
> -- 
> 2.34.1


More information about the Intel-gfx mailing list