On 08/02/2024 4:55 pm, Juergen Gross wrote:
> +static struct p9_fid *alloc_fid_mem(device *device, unsigned int fid,
> +                                    const char *path)
> +{
> +    struct p9_fid *fidp;
> +    size_t pathlen;
> +
> +    pathlen = strlen(path);
> +    fidp = calloc(sizeof(*fidp) + pathlen + 1, 1);
> +    if ( !fidp )
> +        return NULL;
> +
> +    fidp->fid = fid;
> +    strncpy(fidp->path, path, pathlen);
> +
> +    return fidp;
> +}

GitlabCI has something to say about this. 
https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1176787593

I think they're all variations of:

io.c: In function 'alloc_fid_mem.isra.8':
io.c:566:5: error: 'strncpy' output truncated before terminating nul
copying as many bytes from a string as its length
[-Werror=stringop-truncation]
     strncpy(fidp->path, path, pathlen);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
io.c:560:15: note: length computed here
     pathlen = strlen(path);
               ^~~~~~~~~~~~

~Andrew

Reply via email to