RE: [PATCH V3 08/25] smartpqi: add support for long firmware version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: Martin Wilck [mailto:mwilck@xxxxxxxx] 
Subject: Re: [PATCH V3 08/25] smartpqi: add support for long firmware version

> +               snprintf(ctrl_info->firmware_version +
> +                       strlen(ctrl_info->firmware_version),
> +                       sizeof(ctrl_info->firmware_version),

This looks wrong. I suppose a real overflow can't happen, but shouldn't it rather be written like this?

snprintf(ctrl_info->firmware_version +
 sizeof(identify->firmware_version_short),
 sizeof(ctrl_info->firmware_version)
 - sizeof(identify->firmware_version_short),
 "-u", ...)

Don: I updated the code to match your suggeston.
Thank-you for your review,
Don

> +                       "-%u",
> +                       get_unaligned_le16(&identify-
> > firmware_build_number));
> +       }
>
>         memcpy(ctrl_info->model, identify->product_id,
>                 sizeof(identify->product_id)); @@ -9607,13 +9615,23 @@ 
> static void __attribute__((unused))
> verify_structures(void)
>         BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
>                 configuration_signature) != 1);
>         BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
> -               firmware_version) != 5);
> +               firmware_version_short) != 5);
>         BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
>                 extended_logical_unit_count) != 154);
>         BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
>                 firmware_build_number) != 190);
> +       BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
> +               vendor_id) != 200);
> +       BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
> +               product_id) != 208);
> +       BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
> +               extra_controller_flags) != 286);
>         BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
>                 controller_mode) != 292);
> +       BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
> +               spare_part_number) != 293);
> +       BUILD_BUG_ON(offsetof(struct bmic_identify_controller,
> +               firmware_version_long) != 325);
>
>         BUILD_BUG_ON(offsetof(struct bmic_identify_physical_device,
>                 phys_bay_in_box) != 115);
>







[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux