[PATCH] hostfs: Add const qualifier to host_root in hostfs_fill_super()

Richard Weinberger richard at nod.at
Tue Jun 11 13:19:02 PDT 2024


----- Ursprüngliche Mail -----
> Von: "Nathan Chancellor" <nathan at kernel.org>
> An: "Christian Brauner" <brauner at kernel.org>
> CC: "Hongbo Li" <lihongbo22 at huawei.com>, "richard" <richard at nod.at>, "anton ivanov" <anton.ivanov at cambridgegreys.com>,
> "Johannes Berg" <johannes at sipsolutions.net>, "linux-um" <linux-um at lists.infradead.org>, "linux-kernel"
> <linux-kernel at vger.kernel.org>, "Nathan Chancellor" <nathan at kernel.org>
> Gesendet: Dienstag, 11. Juni 2024 21:58:41
> Betreff: [PATCH] hostfs: Add const qualifier to host_root in hostfs_fill_super()

> After the recent conversion to the new mount API, there is a warning
> when building hostfs (which may be upgraded to an error via
> CONFIG_WERROR=y):
> 
>  fs/hostfs/hostfs_kern.c: In function 'hostfs_fill_super':
>  fs/hostfs/hostfs_kern.c:942:27: warning: initialization discards 'const'
>  qualifier from pointer target type [-Wdiscarded-qualifiers]
>    942 |         char *host_root = fc->source;
>        |                           ^~
> 
> Add the 'const' qualifier, as host_root will not be modified after its
> assignment. Move the assignment to keep the existing reverse Christmas
> tree order intact.
> 
> Fixes: cd140ce9f611 ("hostfs: convert hostfs to use the new mount API")
> Signed-off-by: Nathan Chancellor <nathan at kernel.org>

Acked-by: Richard Weinberger <richard at nod.at>

Thanks,
//richard



More information about the linux-um mailing list