Skip to content

Commit

Permalink
powerpc/boot: Fix missing check of lseek() return value
Browse files Browse the repository at this point in the history
This is detected by Coverity scan: CID: 1440481

Signed-off-by: Bo YU <tsu.yubo@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Bo YU authored and Michael Ellerman committed May 2, 2019
1 parent 90437bf commit 5d085ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/powerpc/boot/addnote.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ main(int ac, char **av)
PUT_16(E_PHNUM, np + 2);

/* write back */
lseek(fd, (long) 0, SEEK_SET);
i = lseek(fd, (long) 0, SEEK_SET);
if (i < 0) {
perror("lseek");
exit(1);
}
i = write(fd, buf, n);
if (i < 0) {
perror("write");
Expand Down

0 comments on commit 5d085ec

Please sign in to comment.