2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

Bootconfig fixes for v6.17-rc2:

- bootconfig: Fix negative seeks on 32-bit with LFS enabled
   On 32bit architecture, -BOOTCONFIG_FOOTER_SIZE (size_t, 32bit)
   becomes a positive value when it is passed to lseek() because it
   is casted to off_t (64bit). Thus, add type casts.
 -----BEGIN PGP SIGNATURE-----
 
 iQFPBAABCgA5FiEEh7BulGwFlgAOi5DV2/sHvwUrPxsFAmimV2wbHG1hc2FtaS5o
 aXJhbWF0c3VAZ21haWwuY29tAAoJENv7B78FKz8bDDEH/iA7Ux/YSlns32wt9Q8o
 GIKTpOfFWcJoq7S3ocRM2gTr7h4bJjQ1fo23RypbjEU8YTceo4a6WITs6oyD1L3J
 foEtT6Sl090+Lg4s5NnTcQ22OffivCgDS68siCSmUYqiumBXKdRJNk9HIre3MADX
 fGQxFBZEGU7xtu3g3aQ5txzJk8QNmzbQWL9dLzW9ZwtOabwo3lwvTpLTcmuCCmtA
 IZE9ez2STH0q7CqIG5851e5iqtLsTmyHLOZIzj6H7A2CoRkAumr6ya6cpMu0+vbl
 xq7Trn2/iGU0xwJCqJW2kWKoYZmfyIqMvNKI6aA95fUZOBQtbGnZ+F6TiY2iknuF
 zqA=
 =wdYA
 -----END PGP SIGNATURE-----

Merge tag 'bootconfig-fixes-v6.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull bootconfig fix from Masami Hiramatsu:
 "Fix negative seeks on 32-bit with LFS enabled

  On 32bit architecture, -BOOTCONFIG_FOOTER_SIZE (size_t, 32bit) becomes
  a positive value when it is passed to lseek() because it is cast to
  off_t (64bit). Thus, add type casts"

* tag 'bootconfig-fixes-v6.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  bootconfig: Fix negative seeks on 32-bit with LFS enabled
This commit is contained in:
Linus Torvalds 2025-08-20 16:27:38 -07:00
commit 43f981b7a7

View File

@ -193,7 +193,7 @@ static int load_xbc_from_initrd(int fd, char **buf)
if (stat.st_size < BOOTCONFIG_FOOTER_SIZE)
return 0;
if (lseek(fd, -BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0)
if (lseek(fd, -(off_t)BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0)
return pr_errno("Failed to lseek for magic", -errno);
if (read(fd, magic, BOOTCONFIG_MAGIC_LEN) < 0)
@ -203,7 +203,7 @@ static int load_xbc_from_initrd(int fd, char **buf)
if (memcmp(magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN) != 0)
return 0;
if (lseek(fd, -BOOTCONFIG_FOOTER_SIZE, SEEK_END) < 0)
if (lseek(fd, -(off_t)BOOTCONFIG_FOOTER_SIZE, SEEK_END) < 0)
return pr_errno("Failed to lseek for size", -errno);
if (read(fd, &size, sizeof(uint32_t)) < 0)