linux-um archives
 help / color / mirror / Atom feed
* [PATCH] hostfs: Add const qualifier to host_root in hostfs_fill_super()
@ 2024-06-11 19:58 Nathan Chancellor
  2024-06-11 20:19 ` Richard Weinberger
  2024-06-13 12:12 ` Christian Brauner
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2024-06-11 19:58 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Hongbo Li, Richard Weinberger, Anton Ivanov, Johannes Berg,
	linux-um, linux-kernel, Nathan Chancellor

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@kernel.org>
---
 fs/hostfs/hostfs_kern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 6ec3c368d7bf..e44747bbfe87 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -938,8 +938,8 @@ static const struct inode_operations hostfs_link_iops = {
 static int hostfs_fill_super(struct super_block *sb, struct fs_context *fc)
 {
 	struct hostfs_fs_info *fsi = sb->s_fs_info;
+	const char *host_root = fc->source;
 	struct inode *root_inode;
-	char *host_root = fc->source;
 	int err;
 
 	sb->s_blocksize = 1024;

---
base-commit: cd140ce9f611a5e9d2a5989a282b75e55c71dab3
change-id: 20240611-hostfs-fix-mount-api-conversion-83eda29c74fe

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hostfs: Add const qualifier to host_root in hostfs_fill_super()
  2024-06-11 19:58 [PATCH] hostfs: Add const qualifier to host_root in hostfs_fill_super() Nathan Chancellor
@ 2024-06-11 20:19 ` Richard Weinberger
  2024-06-13 12:12 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2024-06-11 20:19 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Christian Brauner, Hongbo Li, anton ivanov, Johannes Berg,
	linux-um, linux-kernel

----- Ursprüngliche Mail -----
> Von: "Nathan Chancellor" <nathan@kernel.org>
> An: "Christian Brauner" <brauner@kernel.org>
> CC: "Hongbo Li" <lihongbo22@huawei.com>, "richard" <richard@nod.at>, "anton ivanov" <anton.ivanov@cambridgegreys.com>,
> "Johannes Berg" <johannes@sipsolutions.net>, "linux-um" <linux-um@lists.infradead.org>, "linux-kernel"
> <linux-kernel@vger.kernel.org>, "Nathan Chancellor" <nathan@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@kernel.org>

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

Thanks,
//richard


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hostfs: Add const qualifier to host_root in hostfs_fill_super()
  2024-06-11 19:58 [PATCH] hostfs: Add const qualifier to host_root in hostfs_fill_super() Nathan Chancellor
  2024-06-11 20:19 ` Richard Weinberger
@ 2024-06-13 12:12 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-06-13 12:12 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Christian Brauner, Hongbo Li, Richard Weinberger, Anton Ivanov,
	Johannes Berg, linux-um, linux-kernel

On Tue, 11 Jun 2024 12:58:41 -0700, Nathan Chancellor wrote:
> 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;
>         |                           ^~
> 
> [...]

Applied to the vfs.mount.api branch of the vfs/vfs.git tree.
Patches in the vfs.mount.api branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.mount.api

[1/1] hostfs: Add const qualifier to host_root in hostfs_fill_super()
      https://git.kernel.org/vfs/vfs/c/104eef133fd9


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-13 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-11 19:58 [PATCH] hostfs: Add const qualifier to host_root in hostfs_fill_super() Nathan Chancellor
2024-06-11 20:19 ` Richard Weinberger
2024-06-13 12:12 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox