Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2776970rdb; Mon, 12 Feb 2024 17:02:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWNSi66gHe6Bns496uI5JinHEUzdNotBMwUrqam9ySlqYi2HdKgM+cQPxiNBr+Uc5sgOJeJcIOOwudO8wJ4V2ydsrvrqs1owjdDKHWSyQ== X-Google-Smtp-Source: AGHT+IHrpiiND9cs0FeeTlRSC/KZFzu8tK+3TojciInf1XomxmYWle/V8p+9rt09vnuydWGmvxTu X-Received: by 2002:a17:903:40c4:b0:1d7:7347:d80e with SMTP id t4-20020a17090340c400b001d77347d80emr8387454pld.37.1707786128567; Mon, 12 Feb 2024 17:02:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707786128; cv=pass; d=google.com; s=arc-20160816; b=jQPj/Ctc21XFgcYmfdtBOZy+TYZ0/DAAu7/sTa3CvJZSPb1NL4KORo/zDokeP9is29 DYemq3EeGbr6Raw5Q+NWCTXarNC4KsRiSnjfHE2e5kwDEe4f56CvX074RP/eZxzUCVzy hVAifMBfc2diFSRcXu51sgqjAZfAFKhHKYCzowgpMznqWQoeIv90erN+ltr6XvOkFpve UyA8LNqeHxusb1FZLBW9b4/M7fOMz94tVS5SUA+8qE2TphF4R2hmZ1BKMZ2xBKhdYP/1 0bkutWRVrCp8pxFSSR5Uk3m7ZQV4YBn0xoBXMbxT+B8Ny91M0gdexNP1HUlx4W1YGzY0 DiHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XTNG8bpe0NvFn/QJ4DYbJ5h1KL2jaWxdq4pUBxTGrVw=; fh=nh8JKj06UGB/KA5T2K1r0o36Uhki+KE+NhLNYSTagsw=; b=fi39Qtl6ysJRqKxTUrvf2G1f8yyL2fJ3UCP3ZZ87CXm+ak59r9WIKyXBe29B7WRnIZ siE/Z6gvQzdDoBE/uKw4qQNhjoaDz5evD6nNwcAhY8boy7hBP2CGhHP22pRzTv0Km7Wz ObIoKTH+Noqcxb4YHMVqgTxnOwjAFxSv+hEkWkFgtzVqYGfjrONmqvEW7txvkX0iJ7jY KuEWoNXu54c0A+P1WnJqt5vh1/kx9qFnYJ37Vu5AHkvP0e0COgmF/Sri9CZb9RQ8LnsR VCZVGjy98+iakV6EPG7m1mBL27tby2RIrMLgf4HfiYFkJ3MGbgDYPBXeqostXoa4NSiH Tn0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mgG8fzTf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62690-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62690-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUbjPDxB0tpZcf9LYs0XKY+07l7cbmQPb0N7Ay9hpqsTpoMEc1c9K0o2/10kh5qCNdsrwhRlDu5WM4lgGfHZUmjUl4GzlcwfmDHPlXgwQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h11-20020a170902f7cb00b001d9df9a72d3si999892plw.503.2024.02.12.17.02.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 17:02:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62690-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mgG8fzTf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62690-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62690-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B2C58B25574 for ; Tue, 13 Feb 2024 00:51:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BCC3477F18; Tue, 13 Feb 2024 00:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mgG8fzTf" 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 DB6A274E25; Tue, 13 Feb 2024 00:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783765; cv=none; b=NvsrbPhftN9sr2Hg+/qG7PwGPVQbDeruzIo0RLliDs2TOIfLj8sXEkUF1s8PRabj63s5l1gEbFZSYqdZ5y8V5vKkQzIO4rFusm8UJuRN7sDeI5g7ThP/R/xIM8Ht6y73/BfTzwQXM2ZHBqwnajUTTWrypInCO5D0ealJRb8Xsfg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783765; c=relaxed/simple; bh=CIRJBfId1RTlgmGCy2RcJc711guDos+mkPR47Y3W2JM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=THGMmGteJuSHpGNm2zxoCgftXVx11J6IMwzOiVzQXh7eR2wkTnBJawM09eH/u4Gn0DKu49nEMXSGpa5xxGNFcJfud7YRWst5GxuZ/vs4jEbjwJpe/nuwTxbvYjpLWAal3opChO2ld3hBcZC3Uusf0rHO3oRuNVH+FscmwVccKEs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mgG8fzTf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA39FC433F1; Tue, 13 Feb 2024 00:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707783764; bh=CIRJBfId1RTlgmGCy2RcJc711guDos+mkPR47Y3W2JM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mgG8fzTfL4WxZP/sVGRMuv+OPJ/Fflgl26TO3Q8murJgd5c5LnnM+FQ8lieNreRKO dkT+CT7H3NLO0cFiPEFp0DeUxIqsKdrzRWX/YlOoFgDgf1wIc3Dbb35znsRHCB2+1T hYg5i/j8kJLyDdG6MS1YoGLGwI7VhjOZ9u/wZmgl1ay8QJ+1px4LhtcZPl/9lWXW3X G7i+xqQ5DJAWkBoyF+rwvlT1wTrU/uaJ2NNI1983LlftbbYwnJhs1s7TTbHMXzjwjn cYYVbF3Ef5+F9u7Mx87D6f/b8TCMIGijrjLD9R7jTGHavsRvERMRXpfXqemxFdvMB5 6TRZhWrr9yptQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Konstantin Komarov , kernel test robot , Sasha Levin , ntfs3@lists.linux.dev Subject: [PATCH AUTOSEL 6.1 07/28] fs/ntfs3: Disable ATTR_LIST_ENTRY size check Date: Mon, 12 Feb 2024 19:22:05 -0500 Message-ID: <20240213002235.671934-7-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240213002235.671934-1-sashal@kernel.org> References: <20240213002235.671934-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.77 Content-Transfer-Encoding: 8bit From: Konstantin Komarov [ Upstream commit 4cdfb6e7bc9c80142d33bf1d4653a73fa678ba56 ] The use of sizeof(struct ATTR_LIST_ENTRY) has been replaced with le_size(0) due to alignment peculiarities on different platforms. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202312071005.g6YrbaIe-lkp@intel.com/ Signed-off-by: Konstantin Komarov Signed-off-by: Sasha Levin --- fs/ntfs3/attrlist.c | 8 ++++---- fs/ntfs3/ntfs.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/ntfs3/attrlist.c b/fs/ntfs3/attrlist.c index 0c6a68e71e7d..723e49ec83ce 100644 --- a/fs/ntfs3/attrlist.c +++ b/fs/ntfs3/attrlist.c @@ -127,12 +127,13 @@ struct ATTR_LIST_ENTRY *al_enumerate(struct ntfs_inode *ni, { size_t off; u16 sz; + const unsigned le_min_size = le_size(0); if (!le) { le = ni->attr_list.le; } else { sz = le16_to_cpu(le->size); - if (sz < sizeof(struct ATTR_LIST_ENTRY)) { + if (sz < le_min_size) { /* Impossible 'cause we should not return such le. */ return NULL; } @@ -141,7 +142,7 @@ struct ATTR_LIST_ENTRY *al_enumerate(struct ntfs_inode *ni, /* Check boundary. */ off = PtrOffset(ni->attr_list.le, le); - if (off + sizeof(struct ATTR_LIST_ENTRY) > ni->attr_list.size) { + if (off + le_min_size > ni->attr_list.size) { /* The regular end of list. */ return NULL; } @@ -149,8 +150,7 @@ struct ATTR_LIST_ENTRY *al_enumerate(struct ntfs_inode *ni, sz = le16_to_cpu(le->size); /* Check le for errors. */ - if (sz < sizeof(struct ATTR_LIST_ENTRY) || - off + sz > ni->attr_list.size || + if (sz < le_min_size || off + sz > ni->attr_list.size || sz < le->name_off + le->name_len * sizeof(short)) { return NULL; } diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h index 8b580515b1d6..ba26a465b309 100644 --- a/fs/ntfs3/ntfs.h +++ b/fs/ntfs3/ntfs.h @@ -521,8 +521,6 @@ struct ATTR_LIST_ENTRY { }; // sizeof(0x20) -static_assert(sizeof(struct ATTR_LIST_ENTRY) == 0x20); - static inline u32 le_size(u8 name_len) { return ALIGN(offsetof(struct ATTR_LIST_ENTRY, name) + -- 2.43.0