Re: [PATCH v1] 9p: Fix mkdir to return NULL on success

Hongling Zeng <[email protected]> Wed, 20 May 2026 09:42:53 +0800
Newsgroups dev.linux.lists.v9fs,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
  Hi Dominique,

   Thanks for picking this up!

   I received David feedback suggesting to simplify v9fs_vfs_mkdir()
   by removing the 'err' variable and using ERR_CAST(). Since v1 is
   already merged, would you still like a v2, or shall I submit it 
separately?

   Best regards,
   Hongling
在 2026年05月19日 20:21, Dominique Martinet 写道:
> Hongling Zeng wrote on Mon, May 11, 2026 at 02:18:30PM +0800:
>> 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 'ERR_PTR'
>>    fs/9p/vfs_inode.c:695 v9fs_vfs_mkdir() warn: passing zero to 'ERR_PTR'
>>
>> This change does not alter the runtime behavior since ERR_PTR(0) and NULL
>> are equivalent. However, it improves code readability and silences static
>> analyzer warnings.
>>
>> Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *")
>> Acked-by: Christian Schoenebeck <[email protected]>
>> Signed-off-by: Hongling Zeng <[email protected]>
> Thanks, I've picked this up with s/Fix/make/ in the commit subject, as I
> (subjectively) don't consider this a fix given it's only a style change
>