Commit cdc89c91 authored by Prashant Bhole's avatar Prashant Bhole Committed by David S. Miller

tools: bpf: handle long path in jit disasm

Use PATH_MAX instead of hardcoded array size 256
Signed-off-by: default avatarPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e20f4696
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <sys/klog.h> #include <sys/klog.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <limits.h>
#define CMD_ACTION_SIZE_BUFFER 10 #define CMD_ACTION_SIZE_BUFFER 10
#define CMD_ACTION_READ_ALL 3 #define CMD_ACTION_READ_ALL 3
...@@ -51,7 +52,7 @@ static void get_exec_path(char *tpath, size_t size) ...@@ -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) static void get_asm_insns(uint8_t *image, size_t len, int opcodes)
{ {
int count, i, pc = 0; int count, i, pc = 0;
char tpath[256]; char tpath[PATH_MAX];
struct disassemble_info info; struct disassemble_info info;
disassembler_ftype disassemble; disassembler_ftype disassemble;
bfd *bfdf; bfd *bfdf;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <dis-asm.h> #include <dis-asm.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <limits.h>
#include "json_writer.h" #include "json_writer.h"
#include "main.h" #include "main.h"
...@@ -80,7 +81,7 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes) ...@@ -80,7 +81,7 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes)
disassembler_ftype disassemble; disassembler_ftype disassemble;
struct disassemble_info info; struct disassemble_info info;
int count, i, pc = 0; int count, i, pc = 0;
char tpath[256]; char tpath[PATH_MAX];
bfd *bfdf; bfd *bfdf;
if (!len) if (!len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment