[pve-devel] [PATCH pve-qemu-kvm] patch: pbs block driver: correct a data type
Shannon Sterz
s.sterz at proxmox.com
Mon Jun 10 10:53:13 CEST 2024
On Fri Jun 7, 2024 at 11:43 AM CEST, Jing Luo wrote:
> gcc warns (-Werror=type-limits) that it will always be false for the
> if statement. This is because here s->aid is defined as char, while
> proxmox_restore_open_image() returns an int. Change the type to int.
> Strangely gcc warns it on arm64 build but not amd64 build...
probably because char is unsigned on arm architectures (usually), but
signed on x86 [1]:
> Although the ARM architecture has the LDRSB instruction, that loads a
> signed byte into a 32-bit register with sign extension, the earliest
> versions of the architecture did not. It made sense at the time for
> the compiler to treat simple chars as unsigned, whereas on the x86
> simple chars are, by default, treated as signed.
[1]: https://developer.arm.com/documentation/den0013/d/Porting/Miscellaneous-C-porting-issues/unsigned-char-and-signed-char
>
> Signed-off-by: Jing Luo <jing at jing.rocks>
> ---
> ...2-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/debian/patches/pve/0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch b/debian/patches/pve/0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
> index b9578ba..9e68167 100644
> --- a/debian/patches/pve/0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
> +++ b/debian/patches/pve/0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
> @@ -68,7 +68,7 @@ index 0000000000..dd72356bd3
> +
> +typedef struct {
> + ProxmoxRestoreHandle *conn;
> -+ char aid;
> ++ int aid;
> + int64_t length;
> +
> + char *repository;
More information about the pve-devel
mailing list