From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (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 62C3733CE84 for ; Thu, 4 Dec 2025 11:58:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764849521; cv=none; b=aNxZEKGWEx2NFMKhdpufbitsvQpWfBBpwY8pM7lPNlx4N4gtXkxQ52xpP3BY24N8fHFcLM9L6T3nTdEnpedgMy86R+l25ONXvtDdhayVCnVtpp3aBAm364MY8K2ShpXEP5gTOyHqVHKBEziwbsd0mROo6CTED/r7QULS4RUGmVw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764849521; c=relaxed/simple; bh=JuANSFxh/VPKXqNFnxDApb13qGnzHZ/SFN9viaspbcg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:In-Reply-To: Content-Type:References; b=lWms568ocXLLKK9axB//337h0oExvQiEtKi7g2QeFohU21Ka6BeSIznutQ+X6yOTEeUKOF7+H9iGc5+f5xsy4snYfvWGPdoFQC0Eg7m4axNEuROsO5+Mnwivy1FdzzXkK2YEGl+W2Ct+8DDDCiwJNZY1KbkgenAWUCiJqicmpPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=WNAoijqj; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="WNAoijqj" Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20251204115836epoutp03ff9b707c041449ee4431986aed9d7acc~_AUjEGUOV1271212712epoutp03Q for ; Thu, 4 Dec 2025 11:58:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20251204115836epoutp03ff9b707c041449ee4431986aed9d7acc~_AUjEGUOV1271212712epoutp03Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1764849516; bh=3wWMy2I7L9W3gKbAO25UJJg2lWlRN6z4rpA14p0f+88=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=WNAoijqjxk7gcsrOKdxye0+q0KKXeDASJsHid9XKP4nhwUTo+eo4rQ/VQOeFimTe5 d77QJJ/Xqp3D6WvbFLvmJ0LC7yCnkHA3cgEqOOVIiowrmyrb2M1S/NhlqnodFr17HS 4MSa/3pdSpI/jtsoWyoBB+yHhLiVFkc9AmyLLfOo= Received: from epsnrtp01.localdomain (unknown [182.195.42.153]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPS id 20251204115835epcas1p359682f63231cd07bf5fe4c8982386cda~_AUiwccCA1471414714epcas1p3S; Thu, 4 Dec 2025 11:58:35 +0000 (GMT) Received: from epcas1p4.samsung.com (unknown [182.195.38.120]) by epsnrtp01.localdomain (Postfix) with ESMTP id 4dMY1l3KdPz6B9m6; Thu, 4 Dec 2025 11:58:35 +0000 (GMT) Received: from epsmtip1.samsung.com (unknown [182.195.34.30]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20251204115834epcas1p2ff5123e0d43fe249ace1c71c81feada5~_AUiGP2Rm2315023150epcas1p2R; Thu, 4 Dec 2025 11:58:34 +0000 (GMT) Received: from [172.25.92.0] (unknown [10.246.9.208]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20251204115834epsmtip104577396810b1eaf592de68c2c16c99d~_AUiBWoWu1461814618epsmtip1a; Thu, 4 Dec 2025 11:58:34 +0000 (GMT) Message-ID: <5fa3c9d2-e77b-4cf9-95d2-f1fc0eb7292e@samsung.com> Date: Thu, 4 Dec 2025 20:58:34 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] fs: exfat: Fix corrupted error code handling in exfat_find_empty_entry() To: Haotian Zhang , linkinjeon@kernel.org, yuezhang.mo@sony.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Language: en-US From: Sungjong Seo In-Reply-To: <20251203070813.1448-1-vulab@iscas.ac.cn> Content-Transfer-Encoding: 7bit X-CMS-MailID: 20251204115834epcas1p2ff5123e0d43fe249ace1c71c81feada5 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 101P X-CPGSPASS: Y cpgsPolicy: CPGSC10-711,N X-CFilter-Loop: Reflected X-CMS-RootMailID: 20251203070828epcas1p219623b1095d4f34a5af5adada269b14f References: <20251203070813.1448-1-vulab@iscas.ac.cn> Hi, Haotian, On 25. 12. 3. 16:08, Haotian Zhang wrote: > exfat_find_empty_entry() stores the return value of > exfat_alloc_cluster() in an unsigned int. When > exfat_alloc_cluster() returns a negative errno, it is > converted to a large positive value, which corrupts > error propagation to the caller. Have you ever encountered an actual error? IMO, due to implicit type conversion, it should work as follows, so, I don't think there will be any real issues. int -> unsigned int -> int Anyway, it makes sense to modify the type of ret from unsigned int to int. What about changing the title and comment? Thanks. SJ > > Change the type of ret to int so that negative errno > values are preserved. > > Fixes: 5f2aa075070c ("exfat: add inode operations") > Signed-off-by: Haotian Zhang > --- > fs/exfat/namei.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c > index f5f1c4e8a29f..f2a87ecd79f9 100644 > --- a/fs/exfat/namei.c > +++ b/fs/exfat/namei.c > @@ -304,8 +304,8 @@ static int exfat_find_empty_entry(struct inode *inode, > struct exfat_chain *p_dir, int num_entries, > struct exfat_entry_set_cache *es) > { > - int dentry; > - unsigned int ret, last_clu; > + int dentry, ret; > + unsigned int last_clu; > loff_t size = 0; > struct exfat_chain clu; > struct super_block *sb = inode->i_sb;