From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796327958; b=gYJngeM7aX2TW4WH2NxUNmMO5w3q6ZwpDBQzoLVtsTzWh/UKhaUy54muUDM6pU1DyMcl /UNbmH1ys5j5lakj2hHY56YROmRf3xdCDrqR5bBetwmwT2Q4VGjSwdg9eV6zjsLxcIlA9 yBUJCH+YlYzjf8tMNgd9GViSasbMkVtbCpOkw2Clzp4YNaYEiwafO3EKTV2NAtbllKkFx gP0XdwQoIwAvaqZuxAKaZ1rwKHv/xjc40hcwJJeVy1D06F+OAzPlP1eLMs/arGxQuDffh NUpvw/1cuuaYTrpIn885aKbuMtopYWayIcwO019VsRcWsdgWkEYoT2vi6hVBsHDiibg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796327958; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=fFP7FMizZSpGhMmVS1WhzFalPQ0r1gziLjo/CNFg4fw=; b=sFyQpcmSL0xp/wefqlu9T/SC3zddRchi0LE7b/K5gSnkDypWvjYU8vNy2u0VxuonjRCd ZezduRNnJ5aHG8Z/eE0YslosHyKMi0Jc6gnJ+TKFVheScrVDwD/HrmHJ6fY/O4sTTu6P4 YiHiDMCKZOjIaffkc8DHRk/D/GsJNNlyAtZRVyN/GuCc+4QkCPXSIcnqgVqeiKGuW3SvA AwPBxyPNQOARPDrCbRkXGu39pLP9bqDJqz1srs5olKKRiDmVMSotsS3IQH74lrTD0XUrg PF7rsKFMr/zZP315THKmAPXfwdsRns13Rk1IBNtxOtnuA2HyzMtXPpb5n1rS3nQvmpQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=H+BpN+ua; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83526606A322 for ; Thu, 3 Dec 2026 19:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=H+BpN+ua Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE8E41F000C2; Thu, 3 Dec 2026 19:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796327958; bh=fFP7FMizZSpGhMmVS1WhzFalPQ0r1gziLjo/CNFg4fw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=H+BpN+ua+Rac+s968Hv0y7p/SUgGcdw/OgVBcseAzd3bLg9Bqx5oyipJ4wboq3ulW VuP01mwXrcRYfA2JeG+1RVOF9m3FkRslUthzfDAPcXJtvjYJml0g3bx8997TFy5Uuh 4BBf9JVSGtDWgghTyoqc1H+4JrOrYPJSoA/H+z+CpwPydmJTiYX+8Y3L9CmEVJ/m11 5zs0/shcmW5TAb+OdQmJLXlO+wfHjuBCnojK3CpJLppvRcWIVWVstJpNWKtRYYJ/S5 j/cFN+zqBIOYKDXQhJ6pLb4ENQYJPtfyKGE8hMjFl6NJX2iSFAw//i8evYyoFQna/y sWH9ubkJxPWag== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v15 05/13] ext4: add dirdata format definitions and access helpers Reply-To: sashiko-reviews@lists.linux.dev To: "Artem Blagodarenko" , linux-ext4@vger.kernel.org Cc: tytso@mit.edu In-Reply-To: <20261203184938.422849-6-ablagodarenko@thelustrecollective.com> References: <20261203184938.422849-1-ablagodarenko@thelustrecollective.com> <20261203184938.422849-6-ablagodarenko@thelustrecollective.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 19:59:17 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] ext4: ext4_dirent_get_data_len() comment omits included NUL byte - [Low] ext4: unused ext4_dirdata_next() helper bypassed by dirdata parsers -- commit 215944fd5c4851a4433f0516167e85726be4f765 Author: Artem Blagodarenko ext4: add dirdata format definitions and access helpers This commit defines the on-disk flags and structures for ext4 directory entry extension data (dirdata) and adds ext4_dirdata_next() and ext4_dirent_get_data_len() helpers in fs/ext4/ext4.h. > diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h > index a7fc2c2c98e16..a75a8cedd52f6 100644 > --- a/fs/ext4/ext4.h > +++ b/fs/ext4/ext4.h [ ... ] > @@ -4378,6 +4427,80 @@ static inline bool ext4_dir_entry_is_tail(struct e= xt4_dir_entry_2 *de) > t->det_reserved_ft =3D=3D EXT4_FT_DIR_CSUM; > } > =20 > +/* > + * Advance to the next dirdata record header starting from @ddh. > + * > + * Uses READ_ONCE() on ddh_length to prevent the compiler from re-fetchi= ng this > + * on-disk field and to guard against a concurrent write racing with any= bounds > + * check the caller performs on the returned pointer. > + */ > +static inline struct ext4_dirent_data_header * > +ext4_dirdata_next(struct ext4_dirent_data_header *ddh) > +{ > + return (struct ext4_dirent_data_header *) > + ((char *)ddh + READ_ONCE(ddh->ddh_length)); > +} [Severity: Low] Is ext4_dirdata_next() needed? Nothing in this commit or the rest of the series calls it. Even ext4_dirent_get_data_len() below bypasses it because callers must read ddh->ddh_length once and validate it against zero and rec_len before advancing, rather than re-fetching it in ext4_dirdata_next(). Consider dropping ext4_dirdata_next() and updating the commit message. > + > +/* > + * ext4_dirent_get_data_len() - Compute the total dirdata length for an = entry. > + * @de: directory entry > + * @rec_len: the record length of the directory entry (decoded) > + * > + * Computes the length of optional data stored after the filename (and i= ts > + * implicit NUL terminator). Each extension is indicated by a bit in the > + * high 4 bits of de->file_type; the first byte of each extension is its > + * length (including that length byte itself). > + * > + * Returns 0 for tail entries and for entries with no dirdata. > + */ [ ... ] > + if (ddh_len =3D=3D 0 || ddh_len > rec_len - offset) > + return 0; > + dlen +=3D ddh_len + (dlen =3D=3D 0); [Severity: Low] Should the comment above ext4_dirent_get_data_len() document that the returned length includes the 1-byte NUL separator when dirdata is present? The comment describes only the optional data after the NUL terminator, whereas dlen +=3D ddh_len + (dlen =3D=3D 0) adds 1 byte on the first record. A caller that copies ext4_dirent_get_data_len() bytes starting after the NUL byte would overread by 1 byte past rec_len. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203184938.4228= 49-1-ablagodarenko@thelustrecollective.com?part=3D5