makedumpfile.h:makedumpfile.h: check the return value
Subsystems (2)
PATCH 1/1 makedumpfile.h:makedumpfile.h: check the return value
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.
--- makedumpfile.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
makedumpfile.h +6 -1
@@ -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 ;
Signature · 7 lines
2.4.3 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/1 makedumpfile.c: check rhe return value ofset_page_size
check_return: Calling function "set_page_size" without checking return value (as is done elsewhere 5 out of 6 times).
makedumpfile.c:8793: example_checked: "set_page_size(dh.block_size)" has its value checked in "set_page_size(dh.block_size)". But in makedumpfile.c:3213, the function "set_page_size" will not check the return value.
--- makedumpfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
makedumpfile.c +2 -1
@@ -3213,7 +3213,8 @@ initial(void)MSG ("because the cyclic mode doesn't support sadump format.\n" ); } -set_page_size (sadump_page_size ()); +if (!set_page_size (sadump_page_size ())) +return FALSE;if (!sadump_initialize_bitmap_memory ())return FALSE;
Signature · 7 lines
2.4.3 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH]makedumpfile.c: check rhe return value ofset_page_size
Sorry, the format is not good. I will rearrange the patches and repost.
So NACK these patches.
Maybe they should be put in one patch since they are used to remove the coverity scan error report.
----- Original Message -----
Quoted 37 lines
From: "Chao Fan" <[email protected]>
To: [email protected]
Cc: "Chao Fan" <[email protected]>
Sent: Monday, August 24, 2015 11:15:52 AM
Subject: [PATCH]makedumpfile.c: check rhe return valueofset_page_size
check_return: Calling function "set_page_size" without checking return value (as is done elsewhere 5 out of 6 times).makedumpfile.c:8793:
example_checked: "set_page_size(dh.block_size)" has its value checked in "set_page_size(dh.block_size)". But in makedumpfile.c:3213, the function "set_page_size" will not check the return value.Signed-off-by Chao Fan <[email protected]>--- makedumpfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)makedumpfile.c +2
-2@@ -3213,7 +3213,8 @@ initial(void)MSG ("because the cyclic mode doesn't support sadump format.\n" ); } -set_page_size (sadump_page_size ()); +if (!set_page_size (sadump_page_size ())) +return FALSE;if (!sadump_initialize_bitmap_memory ())return FALSE; --2.4.3
Quoted 5 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/1 sadump_info.c: unsigned_compare: This less-than-zero comparison of an unsigned value is never true.
In reply to Chao FanIn sadump_info.c:432: unsigned long block_size = SADUMP_DEFAULT_BLOCK_SIZE.
So block_size is unsigned long value and it is bigger than zero. And this comparison is useful.
--- sadump_info.c | 3 --- 1 file changed, 3 deletions(-)
sadump_info.c +0 -3
@@ -465,9 +465,6 @@ read_sadump_header(char *filename) smh = si->smh_memory; restart: -if (block_size <0 ) -return FALSE; -if (!read_device (sph, block_size, &offset))return ERROR ;
Signature · 7 lines
2.4.3 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec