diff mbox series

[v2,18/18,fixup] module_load_modinfo

Message ID 20210610055755.538119-19-kraxel@redhat.com
State New
Headers show
Series modules: add metadata database | expand

Commit Message

Gerd Hoffmann June 10, 2021, 5:57 a.m. UTC
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 util/module.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Gerd Hoffmann June 10, 2021, 6:24 a.m. UTC | #1
On Thu, Jun 10, 2021 at 07:57:55AM +0200, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Oops.  That should have been squashed into patch #13.

take care,
  Gerd
diff mbox series

Patch

diff --git a/util/module.c b/util/module.c
index 564b8e3da760..4f98cc74ae37 100644
--- a/util/module.c
+++ b/util/module.c
@@ -158,7 +158,7 @@  static void module_load_modinfo(void)
 {
     char *file, *json;
     FILE *fp;
-    int i, size;
+    int i, size, ret;
     Visitor *v;
     Error *errp = NULL;
 
@@ -185,8 +185,8 @@  static void module_load_modinfo(void)
     size = ftell(fp);
     fseek(fp, 0, SEEK_SET);
     json = g_malloc0(size + 1);
-    fread(json, size, 1, fp);
-    json[size] = 0;
+    ret = fread(json, 1, size, fp);
+    json[ret] = 0;
     fclose(fp);
 
     v = qobject_input_visitor_new_str(json, NULL, &errp);