]> xenbits.xensource.com Git - people/wipawel/livepatch-build-tools/commitdiff
Fail if the function is too small to patch
authorRoss Lagerwall <ross.lagerwall@citrix.com>
Tue, 20 Oct 2015 10:52:20 +0000 (11:52 +0100)
committerRoss Lagerwall <ross.lagerwall@citrix.com>
Tue, 20 Oct 2015 10:52:20 +0000 (11:52 +0100)
create-diff-object.c

index 5b8fb09b348ede5a1a4c31090e76d8338c20495f..50648819f0bc3d861e3d9c58c5b647238ed23f21 100644 (file)
@@ -152,6 +152,8 @@ struct xsplice_elf {
        int fd;
 };
 
+#define PATCH_INSN_SIZE 5
+
 struct xsplice_patch_func {
        unsigned long new_addr;
        unsigned long new_size;
@@ -1990,6 +1992,9 @@ void xsplice_create_patches_sections(struct xsplice_elf *kelf,
                        log_debug("lookup for %s @ 0x%016lx len %lu\n",
                                  sym->name, result.value, result.size);
 
+                       if (result.size < PATCH_INSN_SIZE)
+                               ERROR("%s too small to patch", sym->name);
+
                        /* add entry in text section */
                        funcs[index].old_addr = result.value;
                        funcs[index].old_size = result.size;