From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7C475101C0 for ; Mon, 15 May 2023 17:54:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D23BBC433D2; Mon, 15 May 2023 17:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1684173253; bh=sNjFJXXSGnJhGP/9x0qVMOuSRz2T50pkHklqgv1IzY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ac+SfOHkfMgpS27jP8gXxp14+vmzJLAIrA0zidWcURqTSVtNbmCEHl2xEsWUZZ3FW 0qAe4JfO0ee7LIQOvAIUr/U/X0y0xxta5lkAZwx2M2Ugf95fBxgom+PsCZs21nuobI FkR5fVEgLalrJhKB2D2Wz0zLwSYXQjQ2Oq0Kbjnc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jingbo Xu , Gao Xiang , Chao Yu , Sasha Levin Subject: [PATCH 5.4 034/282] erofs: fix potential overflow calculating xattr_isize Date: Mon, 15 May 2023 18:26:52 +0200 Message-Id: <20230515161723.296550598@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515161722.146344674@linuxfoundation.org> References: <20230515161722.146344674@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jingbo Xu [ Upstream commit 1b3567a1969b26f709d82a874498c0754ea841c3 ] Given on-disk i_xattr_icount is 16 bits and xattr_isize is calculated from i_xattr_icount multiplying 4, xattr_isize has a theoretical maximum of 256K (64K * 4). Thus declare xattr_isize as unsigned int to avoid the potential overflow. Fixes: bfb8674dc044 ("staging: erofs: add erofs in-memory stuffs") Signed-off-by: Jingbo Xu Reviewed-by: Gao Xiang Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20230414061810.6479-1-jefflexu@linux.alibaba.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin --- fs/erofs/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 544a453f3076c..cc7a42682814c 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -226,7 +226,7 @@ struct erofs_inode { unsigned char datalayout; unsigned char inode_isize; - unsigned short xattr_isize; + unsigned int xattr_isize; unsigned int xattr_shared_count; unsigned int *xattr_shared_xattrs; -- 2.39.2