Skip to content

Commit

Permalink
tools: bpf: handle long path in jit disasm
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Prashant Bhole authored and David S. Miller committed Nov 2, 2017
1 parent e20f469 commit cdc89c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tools/bpf/bpf_jit_disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion tools/bpf/bpftool/jit_disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cdc89c9

Please sign in to comment.