LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] arch: fix without checked-return value with lseek
@ 2018-10-30 13:21 Bo YU
2019-05-03 6:59 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Bo YU @ 2018-10-30 13:21 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: Bo YU, linuxppc-dev, linux-kernel
lseek should have returned value but we miss it maybe.
This is detected by Coverity scan:
CID: 1440481
Signed-off-by: Bo YU <tsu.yubo@gmail.com>
---
arch/powerpc/boot/addnote.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c
index 9d9f6f334d3c..3da3e2b1b51b 100644
--- a/arch/powerpc/boot/addnote.c
+++ b/arch/powerpc/boot/addnote.c
@@ -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");
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-03 6:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 13:21 [PATCH] arch: fix without checked-return value with lseek Bo YU
2019-05-03 6:59 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).