From: Chao Fan <cfan@redhat.com>
To: kexec@lists.infradead.org
Cc: Chao Fan <cfan@redhat.com>
Subject: [PATCH]makedumpfile.h:makedumpfile.h: check the return value
Date: Mon, 24 Aug 2015 11:15:51 +0800 [thread overview]
Message-ID: <1440386153-21638-1-git-send-email-cfan@redhat.com> (raw)
makedumpfile.h:1748: check_return: Calling function "lseek" without
checking return value.
makedumpfile.c:3394: example_checked: "lseek(bitmap->fd, offset,
SEEK_SET);" has its value checked, But in makedumpfile.h:1748, the
function will not check the return value.
Signed-off-by: Chao Fan <cfan@redhat.com>
---
makedumpfile.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/makedumpfile.h b/makedumpfile.h
index d2fadbd..b8b44e0 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -1745,7 +1745,12 @@ is_dumpable(struct dump_bitmap *bitmap, mdf_pfn_t pfn)
off_t offset;
if (pfn == 0 || bitmap->no_block != pfn/PFN_BUFBITMAP) {
offset = bitmap->offset + BUFSIZE_BITMAP*(pfn/PFN_BUFBITMAP);
- lseek(bitmap->fd, offset, SEEK_SET);
+ if (lseek(bitmap->fd, old_offset, SEEK_SET) < 0 ) {
+ ERRMSG("Can't seek the bitmap(%s). %s\n",
+ bitmap->file_name, strerror(errno));
+ return FALSE;
+ }
+
read(bitmap->fd, bitmap->buf, BUFSIZE_BITMAP);
if (pfn == 0)
bitmap->no_block = 0;
--
2.4.3
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next reply other threads:[~2015-08-24 3:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 3:15 Chao Fan [this message]
2015-08-24 3:15 ` [PATCH]makedumpfile.c: check rhe return value ofset_page_size Chao Fan
2015-08-24 3:26 ` Chao Fan
2015-08-24 3:15 ` [PATCH] sadump_info.c: unsigned_compare: This less-than-zero comparison of an unsigned value is never true Chao Fan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440386153-21638-1-git-send-email-cfan@redhat.com \
--to=cfan@redhat.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox