From: Al Viro Date: Sat, 4 May 2013 19:18:53 +0000 (-0400) Subject: create_mnt_ns: unidiomatic use of list_add() X-Git-Tag: firefly_0821_release~3680^2~580^2~6 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b1983cd897ec06080ec4884989c6a3f1e7ee7dce;p=firefly-linux-kernel-4.4.55.git create_mnt_ns: unidiomatic use of list_add() while list_add(A, B) and list_add(B, A) are equivalent when both A and B are guaranteed to be empty, the usual idiom is list_add(what, where), not the other way round... Not a bug per se, but only by accident and it makes RTFS harder for no good reason. Spotted-by: Rajat Sharma Signed-off-by: Al Viro --- diff --git a/fs/namespace.c b/fs/namespace.c index b68eef2d592a..7b1ca9ba0b0a 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2463,7 +2463,7 @@ static struct mnt_namespace *create_mnt_ns(struct vfsmount *m) struct mount *mnt = real_mount(m); mnt->mnt_ns = new_ns; new_ns->root = mnt; - list_add(&new_ns->list, &mnt->mnt_list); + list_add(&mnt->mnt_list, &new_ns->list); } else { mntput(m); }