Skip to content

Commit d24ed99

Browse files
Björn Töpelborkmann
authored andcommitted
libbpf: remove unnecessary cast-to-void
The patches with fixes tags added a cast-to-void in the places when the return value of a function was ignored. This is not common practice in the kernel, and is therefore removed in this patch. Reported-by: Daniel Borkmann <daniel@iogearbox.net> Fixes: 5750902 ("libbpf: proper XSKMAP cleanup") Fixes: 0e6741f ("libbpf: fix invalid munmap call") Signed-off-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 581b31c commit d24ed99

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

tools/lib/bpf/xsk.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ static void xsk_clear_bpf_maps(struct xsk_socket *xsk)
459459
{
460460
int qid = false;
461461

462-
(void)bpf_map_update_elem(xsk->qidconf_map_fd, &xsk->queue_id, &qid, 0);
463-
(void)bpf_map_delete_elem(xsk->xsks_map_fd, &xsk->queue_id);
462+
bpf_map_update_elem(xsk->qidconf_map_fd, &xsk->queue_id, &qid, 0);
463+
bpf_map_delete_elem(xsk->xsks_map_fd, &xsk->queue_id);
464464
}
465465

466466
static int xsk_set_bpf_maps(struct xsk_socket *xsk)
@@ -686,12 +686,10 @@ int xsk_umem__delete(struct xsk_umem *umem)
686686
optlen = sizeof(off);
687687
err = getsockopt(umem->fd, SOL_XDP, XDP_MMAP_OFFSETS, &off, &optlen);
688688
if (!err) {
689-
(void)munmap(umem->fill->ring - off.fr.desc,
690-
off.fr.desc +
691-
umem->config.fill_size * sizeof(__u64));
692-
(void)munmap(umem->comp->ring - off.cr.desc,
693-
off.cr.desc +
694-
umem->config.comp_size * sizeof(__u64));
689+
munmap(umem->fill->ring - off.fr.desc,
690+
off.fr.desc + umem->config.fill_size * sizeof(__u64));
691+
munmap(umem->comp->ring - off.cr.desc,
692+
off.cr.desc + umem->config.comp_size * sizeof(__u64));
695693
}
696694

697695
close(umem->fd);
@@ -717,14 +715,12 @@ void xsk_socket__delete(struct xsk_socket *xsk)
717715
err = getsockopt(xsk->fd, SOL_XDP, XDP_MMAP_OFFSETS, &off, &optlen);
718716
if (!err) {
719717
if (xsk->rx) {
720-
(void)munmap(xsk->rx->ring - off.rx.desc,
721-
off.rx.desc +
722-
xsk->config.rx_size * desc_sz);
718+
munmap(xsk->rx->ring - off.rx.desc,
719+
off.rx.desc + xsk->config.rx_size * desc_sz);
723720
}
724721
if (xsk->tx) {
725-
(void)munmap(xsk->tx->ring - off.tx.desc,
726-
off.tx.desc +
727-
xsk->config.tx_size * desc_sz);
722+
munmap(xsk->tx->ring - off.tx.desc,
723+
off.tx.desc + xsk->config.tx_size * desc_sz);
728724
}
729725

730726
}

0 commit comments

Comments
 (0)