Re: [PATCH] adfs: Fix incorrect unsigned return type in adfs_f_getnext()
From: Russell King (Oracle)
Date: Wed Dec 03 2025 - 04:13:47 EST
On Wed, Dec 03, 2025 at 02:51:20PM +0800, Haotian Zhang wrote:
> adfs_f_getnext() stores the return value of __adfs_dir_get() into an
> unsigned int. Since __adfs_dir_get() may return negative error codes
> such as -ENOENT, these values are converted into large positive numbers.
>
> Change the return variable to type int to correctly preserve and return
> negative error codes.
>
> Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>
The real problem here is the unsigned int -> int conversion, which is
implementation defined in C. int -> unsigned int itself is well
defined.
Reviewed-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>
Thanks!
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!