mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-09 02:24:45 +00:00
DM: Fix potential overflow and return value issues
Fix by a fixed string length and correcting return value Signed-off-by: Huang Yang <yang.huang@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
@@ -133,7 +133,7 @@ static void rpmb_sim_close(void)
|
||||
rpmb_fd = NULL;
|
||||
}
|
||||
|
||||
static size_t file_write(FILE *fp, const void *buf, size_t size, off_t offset)
|
||||
static int file_write(FILE *fp, const void *buf, size_t size, off_t offset)
|
||||
{
|
||||
size_t rc = 0;
|
||||
|
||||
@@ -147,15 +147,14 @@ static size_t file_write(FILE *fp, const void *buf, size_t size, off_t offset)
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = fflush(fp);
|
||||
if (rc < 0) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
if (fflush(fp) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static size_t file_read(FILE *fp, void *buf, size_t size, off_t offset)
|
||||
static int file_read(FILE *fp, void *buf, size_t size, off_t offset)
|
||||
{
|
||||
size_t rc = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user