All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf] libbpf: remove unnecessary cast-to-void
@ 2019-05-06  9:24 Björn Töpel
  2019-05-06  9:36 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Björn Töpel @ 2019-05-06  9:24 UTC (permalink / raw)
  To: ast, daniel, netdev
  Cc: Björn Töpel, magnus.karlsson, magnus.karlsson, bpf

From: Björn Töpel <bjorn.topel@intel.com>

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: 5750902a6e9b ("libbpf: proper XSKMAP cleanup")
Fixes: 0e6741f09297 ("libbpf: fix invalid munmap call")
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
---
 tools/lib/bpf/xsk.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 525f1cc163b5..a3d1a302bc9c 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -459,8 +459,8 @@ static void xsk_clear_bpf_maps(struct xsk_socket *xsk)
 {
 	int qid = false;
 
-	(void)bpf_map_update_elem(xsk->qidconf_map_fd, &xsk->queue_id, &qid, 0);
-	(void)bpf_map_delete_elem(xsk->xsks_map_fd, &xsk->queue_id);
+	bpf_map_update_elem(xsk->qidconf_map_fd, &xsk->queue_id, &qid, 0);
+	bpf_map_delete_elem(xsk->xsks_map_fd, &xsk->queue_id);
 }
 
 static int xsk_set_bpf_maps(struct xsk_socket *xsk)
@@ -686,12 +686,10 @@ int xsk_umem__delete(struct xsk_umem *umem)
 	optlen = sizeof(off);
 	err = getsockopt(umem->fd, SOL_XDP, XDP_MMAP_OFFSETS, &off, &optlen);
 	if (!err) {
-		(void)munmap(umem->fill->ring - off.fr.desc,
-			     off.fr.desc +
-			     umem->config.fill_size * sizeof(__u64));
-		(void)munmap(umem->comp->ring - off.cr.desc,
-			     off.cr.desc +
-			     umem->config.comp_size * sizeof(__u64));
+		munmap(umem->fill->ring - off.fr.desc,
+		       off.fr.desc + umem->config.fill_size * sizeof(__u64));
+		munmap(umem->comp->ring - off.cr.desc,
+		       off.cr.desc + umem->config.comp_size * sizeof(__u64));
 	}
 
 	close(umem->fd);
@@ -717,14 +715,12 @@ void xsk_socket__delete(struct xsk_socket *xsk)
 	err = getsockopt(xsk->fd, SOL_XDP, XDP_MMAP_OFFSETS, &off, &optlen);
 	if (!err) {
 		if (xsk->rx) {
-			(void)munmap(xsk->rx->ring - off.rx.desc,
-				     off.rx.desc +
-				     xsk->config.rx_size * desc_sz);
+			munmap(xsk->rx->ring - off.rx.desc,
+			       off.rx.desc + xsk->config.rx_size * desc_sz);
 		}
 		if (xsk->tx) {
-			(void)munmap(xsk->tx->ring - off.tx.desc,
-				     off.tx.desc +
-				     xsk->config.tx_size * desc_sz);
+			munmap(xsk->tx->ring - off.tx.desc,
+			       off.tx.desc + xsk->config.tx_size * desc_sz);
 		}
 
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf] libbpf: remove unnecessary cast-to-void
  2019-05-06  9:24 [PATCH bpf] libbpf: remove unnecessary cast-to-void Björn Töpel
@ 2019-05-06  9:36 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2019-05-06  9:36 UTC (permalink / raw)
  To: Björn Töpel, ast, netdev
  Cc: Björn Töpel, magnus.karlsson, magnus.karlsson, bpf

On 05/06/2019 11:24 AM, Björn Töpel wrote:
> From: Björn Töpel <bjorn.topel@intel.com>
> 
> 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: 5750902a6e9b ("libbpf: proper XSKMAP cleanup")
> Fixes: 0e6741f09297 ("libbpf: fix invalid munmap call")
> Signed-off-by: Björn Töpel <bjorn.topel@intel.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-06  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-06  9:24 [PATCH bpf] libbpf: remove unnecessary cast-to-void Björn Töpel
2019-05-06  9:36 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.