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

Re: [libvirt] [PATCHv2 01/10] Replace sscanf in legacy device address parsing



On 03/31/2010 03:41 PM, Matthias Bolte wrote:
> Parsing is stricter now and doesn't accept trailing characters
> after the actual <domain>:<bus>:<slot> sequence anymore.
>  
> +static int
> +virDomainParseLegacyDeviceAddress(char *devaddr,
> +                                  virDomainDevicePCIAddressPtr pci)
> +{
> +    char *tmp;
> +
> +    /* expected format: <domain>:<bus>:<slot> */
> +    if (/* domain */
> +        virStrToLong_ui(devaddr, &tmp, 16, &pci->domain) < 0 || *tmp != ':' ||
> +        /* bus */
> +        virStrToLong_ui(tmp + 1, &tmp, 16, &pci->bus) < 0 || *tmp != ':' ||
> +        /* slot */
> +        virStrToLong_ui(tmp + 1, NULL, 16, &pci->slot) < 0)
> +        return -1;
> +
> +    return 0;
> +}

ACK.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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