[pve-devel] [PATCH pve-qemu-kvm] patch: pbs block driver: correct a data type

Fiona Ebner f.ebner at proxmox.com
Fri Jun 7 13:49:29 CEST 2024


Hi,

if you haven't already done so, please send a signed copy of the Harmony
CLA to office at proxmox.com, see [0].

Am 07.06.24 um 11:43 schrieb Jing Luo:
> 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...
> 

Thank you for the report!

> 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;

I'd rather make it an explicit uint8_t here (because that is the type
for other functions taking the aid as a parameter, e.g.
proxmox_restore_get_image_length()). And to fix the original issue, I'd
use the ret variable to store the result from
proxmox_restore_open_image() and only assign to s->aid after checking
that the returned value is not an error and that it is small enough to
fit into uint8_t.

[0]:
https://pve.proxmox.com/wiki/Developer_Documentation#Software_License_and_Copyright

Best Regards,
Fiona




More information about the pve-devel mailing list