[PATCH]makedumpfile.h:makedumpfile.h: check the return value

Chao Fan cfan at redhat.com
Sun Aug 23 20:15:51 PDT 2015


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 at 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




More information about the kexec mailing list