From nobody Sat Jun 13 06:23:05 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4DCF1C695 for ; Sat, 9 May 2026 06:37:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778308677; cv=none; b=O9ikp2sqA7hztHUBoRuBBP0yfByZS+dpIzcNcxd1zrrJAVxImjm2iNjpqkAoqtNVarh7gwHxhoUZsRjKVqqi7sHlq7zRCCL8Epqx8vrVN2k1ukkDynoZj2tlTW3M1BEtkgUF1hbGxg86IQLAUl77KdE/1gmLCUk2Huyh7jpVsVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778308677; c=relaxed/simple; bh=pC51zjX0XI+dXSejp7IhlBtgctdJysAvzC+OlNOWATw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=SF9rwFQ/t1sVRsf2edJFsyV0o33kH2Nul8k6n8j/R93gWfKQS3WDxJetsCIWmU3axMVHlt06GzRX6uwp7ScIyPfqLgss6XFWcs3uEwM2afmrugFg9Ao2dib1Zufel/aybrayni8p3Z2l5A3dfFl7OHldeGWp4m06FsbPN1RovtI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 95ca45784b7111f1aa26b74ffac11d73-20260509 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:d1b6f964-624d-4d4e-98b3-7cec6e6697d9,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:e7bac3a,CLOUDID:d4bd67b4082fd66284fe3f9141129f5d,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|850|898,TC:nil,Content:0|15|50,EDM:- 3,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,A V:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 95ca45784b7111f1aa26b74ffac11d73-20260509 X-User: zenghongling@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 437967962; Sat, 09 May 2026 14:37:44 +0800 From: Hongling Zeng To: ericvh@kernel.org, lucho@ionkov.net, asmadeus@codewreck.org, linux_oss@crudebyte.com Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Hongling Zeng Subject: [PATCH] 9p: Fix mkdir to return NULL on success Date: Sat, 9 May 2026 14:37:33 +0800 Message-Id: <20260509063733.50009-1-zenghongling@kylinos.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When mkdir succeeds, v9fs_vfs_mkdir_dotl() and v9fs_vfs_mkdir() return ERR_PTR(0) which is incorrect. They should return NULL instead for success and ERR_PTR() only with negative error codes for failure. Return NULL instead of passing to ERR_PTR while err is zero Fixes smatch warnings: fs/9p/vfs_inode_dotl.c:420 v9fs_vfs_mkdir_dotl() warn: passing zero to 'E= RR_PTR' fs/9p/vfs_inode.c:695 v9fs_vfs_mkdir() warn: passing zero to 'ERR_PTR' Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry= *") Signed-off-by: Hongling Zeng Acked-by: Christian Schoenebeck --- fs/9p/vfs_inode.c | 5 ++--- fs/9p/vfs_inode_dotl.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index d1508b1fe109..d2d18c796b58 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -672,13 +672,12 @@ v9fs_vfs_create(struct mnt_idmap *idmap, struct inode= *dir, static struct dentry *v9fs_vfs_mkdir(struct mnt_idmap *idmap, struct inode= *dir, struct dentry *dentry, umode_t mode) { - int err; + int err =3D 0; u32 perm; struct p9_fid *fid; struct v9fs_session_info *v9ses; =20 p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry); - err =3D 0; v9ses =3D v9fs_inode2v9ses(dir); perm =3D unixmode2p9mode(v9ses, mode | S_IFDIR); fid =3D v9fs_create(v9ses, dir, dentry, NULL, perm, P9_OREAD); @@ -692,7 +691,7 @@ static struct dentry *v9fs_vfs_mkdir(struct mnt_idmap *= idmap, struct inode *dir, =20 if (fid) p9_fid_put(fid); - return ERR_PTR(err); + return err ? ERR_PTR(err) : NULL; } =20 /** diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 71796a89bcf4..83a52a85ce08 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -349,7 +349,7 @@ static struct dentry *v9fs_vfs_mkdir_dotl(struct mnt_id= map *idmap, struct inode *dir, struct dentry *dentry, umode_t omode) { - int err; + int err =3D 0; struct v9fs_session_info *v9ses; struct p9_fid *fid =3D NULL, *dfid =3D NULL; kgid_t gid; @@ -412,7 +412,7 @@ static struct dentry *v9fs_vfs_mkdir_dotl(struct mnt_id= map *idmap, p9_fid_put(fid); v9fs_put_acl(dacl, pacl); p9_fid_put(dfid); - return ERR_PTR(err); + return err ? ERR_PTR(err) : NULL; } =20 static int --=20 2.25.1