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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20221119131650.21525-1-jiasheng@iscas.ac.cn>
Date:   Sat, 19 Nov 2022 21:16:50 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     contact@...rsion.fr
Cc:     harry.wentland@....com, sunpeng.li@....com,
        Rodrigo.Siqueira@....com, alexander.deucher@....com,
        christian.koenig@....com, Xinhui.Pan@....com, airlied@...il.com,
        daniel@...ll.ch, nicholas.kazlauskas@....com, roman.li@....com,
        aurabindo.pillai@....com, Jerry.Zuo@....com,
        dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] drm/amd/display: rewrite the check for mods

On Thu, 17 Nov 2022 15:56:09 +0800, Simon Ser wrote:
>> @@ -638,11 +638,14 @@ static int get_plane_modifiers(struct amdgpu_device *adev, unsigned int plane_ty
>>  		return 0;
>>  
>>  	*mods = kmalloc(capacity * sizeof(uint64_t), GFP_KERNEL);
>> +	if (!*mods)
>> +		return -ENOMEM;
>> +
>>  
>>  	if (plane_type == DRM_PLANE_TYPE_CURSOR) {
>>  		add_modifier(mods, &size, &capacity, DRM_FORMAT_MOD_LINEAR);
>>  		add_modifier(mods, &size, &capacity, DRM_FORMAT_MOD_INVALID);
>> -		return *mods ? 0 : -ENOMEM;
>> +		return 0;
>>  	}
>>  
>>  	switch (adev->family) {
>> @@ -671,9 +674,6 @@ static int get_plane_modifiers(struct amdgpu_device *adev, unsigned int plane_ty
>>  	/* INVALID marks the end of the list. */
>>  	add_modifier(mods, &size, &capacity, DRM_FORMAT_MOD_INVALID);
>>  
>> -	if (!*mods)
>> -		return -ENOMEM;
>> -
>>  	return 0;
>>  }
 
> This breaks the "size" out-parameter.

No, it will not change the value of the "size".
The "size" can only be modified by add_modifier().
However, when the "*mods" is NULL, add_modifier() will return immediately,
without the execution of "*size += 1;".
Therefore, when the "*mods" is NULL, the rest of the function is useless,
which should be better to skip.

Jiang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ