Skip to content

Commit 43f981b

Browse files
committed
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
2 parents 41cd3fd + 729dc34 commit 43f981b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/bootconfig/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int load_xbc_from_initrd(int fd, char **buf)
193193
if (stat.st_size < BOOTCONFIG_FOOTER_SIZE)
194194
return 0;
195195

196-
if (lseek(fd, -BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0)
196+
if (lseek(fd, -(off_t)BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0)
197197
return pr_errno("Failed to lseek for magic", -errno);
198198

199199
if (read(fd, magic, BOOTCONFIG_MAGIC_LEN) < 0)
@@ -203,7 +203,7 @@ static int load_xbc_from_initrd(int fd, char **buf)
203203
if (memcmp(magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN) != 0)
204204
return 0;
205205

206-
if (lseek(fd, -BOOTCONFIG_FOOTER_SIZE, SEEK_END) < 0)
206+
if (lseek(fd, -(off_t)BOOTCONFIG_FOOTER_SIZE, SEEK_END) < 0)
207207
return pr_errno("Failed to lseek for size", -errno);
208208

209209
if (read(fd, &size, sizeof(uint32_t)) < 0)

0 commit comments

Comments
 (0)