#define BPF_REG_SIZE 8
#define BPF_MAXSTRINGLEN 64
+#define BPF_MAXSTRINGLEN_PLUS 65
// #define BPF_MAXSTRINGLEN 128 // TODO: Longer strings require a smarter storage allocator.
+// #define BPF_MAXSTRINGLEN_PLUS 129
#define BPF_MAXFORMATLEN 256
#define BPF_MAXPRINTFARGS 32
// #define BPF_MAXPRINTFARGS 3 // Maximum for trace_printk() method.
// with a single map during execution of nested foreach loops.
if (!key && is_str)
{
- char k[BPF_MAXSTRINGLEN], n[BPF_MAXSTRINGLEN];
+ // XXX: BPF_MAXSTRINGLEN+1 to avoid coverity warning
+ char k[BPF_MAXSTRINGLEN_PLUS], n[BPF_MAXSTRINGLEN_PLUS];
std::set<std::string> s;
int rc = bpf_get_next_key(fd, 0, as_ptr(n));
uint64_t result = 0; // return value
uint64_t stack[512 / 8];
uint64_t regs[MAX_BPF_REG];
+ memset(regs, 0x0, sizeof(uint64_t) * MAX_BPF_REG);
const struct bpf_insn *i = insns;
static std::vector<uint64_t *> map_values;
static std::vector<std::string> strings; // TODO: could clear on exit?
case BPF_ALU | BPF_OR | BPF_X:
case BPF_ALU | BPF_OR | BPF_K: dr = (uint32_t)(dr | s1); break;
case BPF_ALU | BPF_LSH | BPF_X:
- case BPF_ALU | BPF_LSH | BPF_K: dr = (uint32_t)dr << s1; break;
+ case BPF_ALU | BPF_LSH | BPF_K:
+ // XXX: signal to coverity that we really do want a 32-bit result
+ dr = (uint64_t)((uint32_t)dr << s1); break;
case BPF_ALU | BPF_RSH | BPF_X:
case BPF_ALU | BPF_RSH | BPF_K: dr = (uint32_t)dr >> s1; break;
case BPF_ALU | BPF_XOR | BPF_X: