]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
tools: bpf: handle long path in jit disasm
authorPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Thu, 2 Nov 2017 08:09:45 +0000 (17:09 +0900)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Nov 2017 11:25:27 +0000 (20:25 +0900)
Use PATH_MAX instead of hardcoded array size 256

Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/bpf/bpf_jit_disasm.c
tools/bpf/bpftool/jit_disasm.c

index 422d9abd666a60a2c526eeb6581ea83a5fc577b7..75bf526a01686990f4204ad69e50811fbc7d40be 100644 (file)
@@ -27,6 +27,7 @@
 #include <sys/klog.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <limits.h>
 
 #define CMD_ACTION_SIZE_BUFFER         10
 #define CMD_ACTION_READ_ALL            3
@@ -51,7 +52,7 @@ static void get_exec_path(char *tpath, size_t size)
 static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
 {
        int count, i, pc = 0;
-       char tpath[256];
+       char tpath[PATH_MAX];
        struct disassemble_info info;
        disassembler_ftype disassemble;
        bfd *bfdf;
index 5937e134e408f31e2978e64b45eaf2d85be28b6f..1551d3918d4cdc7c73e9b0e5f952740b6c6d40b9 100644 (file)
@@ -21,6 +21,7 @@
 #include <dis-asm.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <limits.h>
 
 #include "json_writer.h"
 #include "main.h"
@@ -80,7 +81,7 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes)
        disassembler_ftype disassemble;
        struct disassemble_info info;
        int count, i, pc = 0;
-       char tpath[256];
+       char tpath[PATH_MAX];
        bfd *bfdf;
 
        if (!len)