Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]makedumpfile.h:makedumpfile.h: check the return value
@ 2015-08-24  3:15 Chao Fan
  2015-08-24  3:15 ` [PATCH]makedumpfile.c: check rhe return value ofset_page_size 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
  0 siblings, 2 replies; 4+ messages in thread
From: Chao Fan @ 2015-08-24  3:15 UTC (permalink / raw)
  To: kexec; +Cc: Chao Fan

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-24  3:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24  3:15 [PATCH]makedumpfile.h:makedumpfile.h: check the return value Chao Fan
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox