diff mbox series

[net-next] bpf: Use PTR_ERR_OR_ZERO in bpf_fd_sk_storage_update_elem()

Message ID 20190429135611.72640-1-yuehaibing@huawei.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series [net-next] bpf: Use PTR_ERR_OR_ZERO in bpf_fd_sk_storage_update_elem() | expand

Commit Message

Yue Haibing April 29, 2019, 1:56 p.m. UTC
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 net/core/bpf_sk_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin KaFai Lau April 29, 2019, 3:40 p.m. UTC | #1
On Mon, Apr 29, 2019 at 01:56:11PM +0000, YueHaibing wrote:
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Acked-by: Martin KaFai Lau <kafai@fb.com>
Martin KaFai Lau April 29, 2019, 3:40 p.m. UTC | #2
On Mon, Apr 29, 2019 at 08:40:17AM -0700, Martin KaFai Lau wrote:
> On Mon, Apr 29, 2019 at 01:56:11PM +0000, YueHaibing wrote:
> > Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> Acked-by: Martin KaFai Lau <kafai@fb.com>
btw, that should go to the bpf-next branch.
Alexei Starovoitov May 5, 2019, 6:23 a.m. UTC | #3
On Mon, Apr 29, 2019 at 8:42 AM Martin Lau <kafai@fb.com> wrote:
>
> On Mon, Apr 29, 2019 at 08:40:17AM -0700, Martin KaFai Lau wrote:
> > On Mon, Apr 29, 2019 at 01:56:11PM +0000, YueHaibing wrote:
> > > Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> > Acked-by: Martin KaFai Lau <kafai@fb.com>
> btw, that should go to the bpf-next branch.

Applied to bpf-next. Thanks!
diff mbox series

Patch

diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c
index a8e9ac71b22d..cc9597a87770 100644
--- a/net/core/bpf_sk_storage.c
+++ b/net/core/bpf_sk_storage.c
@@ -708,7 +708,7 @@  static int bpf_fd_sk_storage_update_elem(struct bpf_map *map, void *key,
 	if (sock) {
 		sdata = sk_storage_update(sock->sk, map, value, map_flags);
 		sockfd_put(sock);
-		return IS_ERR(sdata) ? PTR_ERR(sdata) : 0;
+		return PTR_ERR_OR_ZERO(sdata);
 	}
 
 	return err;