|
@@ -28,8 +28,8 @@ int symbol__annotate_init(struct map *map __used, struct symbol *sym)
|
|
|
int symbol__alloc_hist(struct symbol *sym)
|
|
|
{
|
|
|
struct annotation *notes = symbol__annotation(sym);
|
|
|
- size_t sizeof_sym_hist = (sizeof(struct sym_hist) +
|
|
|
- (sym->end - sym->start) * sizeof(u64));
|
|
|
+ const size_t size = sym->end - sym->start + 1;
|
|
|
+ size_t sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(u64));
|
|
|
|
|
|
notes->src = zalloc(sizeof(*notes->src) + symbol_conf.nr_events * sizeof_sym_hist);
|
|
|
if (notes->src == NULL)
|
|
@@ -64,7 +64,7 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
|
|
|
|
|
|
pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
|
|
|
|
|
|
- if (addr >= sym->end)
|
|
|
+ if (addr > sym->end)
|
|
|
return 0;
|
|
|
|
|
|
offset = addr - sym->start;
|