[PATCH 05/13] staging: nvec: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/nvec/nvec_ps2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_p

[PATCH 13/13] staging: wimax: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/wimax/i2400m/netdev.c | 6 +++--- drivers/staging/wimax/i2400m/usb.c| 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drive

[PATCH 08/13] staging: rtl8188eu: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c

[PATCH 12/13] staging: sm750fb: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/sm750fb/sm750.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm7

[PATCH 02/13] staging: greybus: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/greybus/audio_helper.c | 2 +- drivers/staging/greybus/audio_module.c | 2 +- drivers/staging/greybus/audio_topology.c | 6 +++--- drivers/stagi

[PATCH 01/13] staging: comedi: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/stag

[PATCH 07/13] staging: olpc_dcon: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/olpc_dcon/olpc_dcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging

[PATCH 10/13] staging: rtl8192u: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u

[PATCH 09/13] staging: rtl8192e: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_et

[PATCH 04/13] staging: most: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/most/sound/sound.c | 2 +- drivers/staging/most/video/video.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/

[PATCH 06/13] staging: octeon: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/octeon/ethernet-mdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/stag

[PATCH 00/13] Convert all users of strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
call sites that expect truncation. $ spatch --sp-file strscpy.cocci --include-headers --dir --in-place drivers/staging @strscpy@ expression dest, src, size; @@ -strlcpy(dest, src, size); +strscpy(dest, src, size); 2. Each individual automated conversion was rechecked manually for correctness. Kumar

[PATCH 11/13] staging: rtl8712: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drive

[PATCH 03/13] staging: fsl-dpaa2: Switch from strlcpy to strscpy

2021-01-31 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw-et

[PATCH v2] staging: qlge/qlge_ethtool.c: Switch from strlcpy to strscpy

2021-01-30 Thread Kumar Kartikeya Dwivedi
checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/qlge/qlge_ethtool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/qlge/qlge_ethtool.c b/drivers/st

[PATCH] staging: qlge/qlge_ethtool.c: strlcpy -> strscpy

2021-01-28 Thread Kumar Kartikeya Dwivedi
Fixes checkpatch warnings for usage of strlcpy. Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/qlge/qlge_ethtool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/qlge/qlge_ethtool.c b/drivers/staging/qlge/qlge_ethtool.c index a28f0254c

[PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-03-25 Thread Kumar Kartikeya Dwivedi
c_act_attach(fd, NULL, ); if (r < 0) return r; if (bpf_tc_act_detach(index)) return -1; ... which is equivalent to the following sequence: tc action add action bpf obj /home/kkd/foo.o sec action tc action del action bpf index Reviewed-by: Toke H

[PATCH bpf-next 4/5] libbpf: add high level TC-BPF API

2021-03-25 Thread Kumar Kartikeya Dwivedi
ERR(link); bpf_link__destroy(link); Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Kumar Kartikeya Dwivedi --- tools/lib/bpf/libbpf.c | 110 ++- tools/lib/bpf/libbpf.h | 15 ++ tools/lib/bpf/libbpf.map | 3 ++ 3 files changed, 127 insertions

[PATCH bpf-next 2/5] libbpf: add helpers for preparing netlink attributes

2021-03-25 Thread Kumar Kartikeya Dwivedi
the open coded attribute preparation with the helpers. Note that the only failure the internal call to add_nlattr could result in the nested helper would be -EMSGSIZE, hence that is what we return to our caller. Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Kumar Kartikeya Dwivedi --- tools

[PATCH bpf-next 0/5] libbpf: Add TC-BPF API

2021-03-25 Thread Kumar Kartikeya Dwivedi
, which will also cause the filter/action to be detached if not disconnected. The individual commits contain a general API summary and examples. Kumar Kartikeya Dwivedi (5): tools pkt_cls.h: sync with kernel sources libbpf: add helpers for preparing netlink attributes libbpf: add low level TC

[PATCH bpf-next 1/5] tools pkt_cls.h: sync with kernel sources

2021-03-25 Thread Kumar Kartikeya Dwivedi
Update the header file so we can use the new defines in subsequent patches. Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Kumar Kartikeya Dwivedi --- tools/include/uapi/linux/pkt_cls.h | 174 - 1 file changed, 170 insertions(+), 4 deletions(-) diff --git

[PATCH bpf-next 5/5] libbpf: add selftests for TC-BPF API

2021-03-25 Thread Kumar Kartikeya Dwivedi
This adds some basic tests for the low level bpf_tc_* API and its bpf_program__attach_tc_* wrapper on top. Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Kumar Kartikeya Dwivedi --- .../selftests/bpf/prog_tests/test_tc_bpf.c| 261 ++ .../selftests/bpf/progs

Re: [PATCH bpf-next 1/5] tools pkt_cls.h: sync with kernel sources

2021-03-26 Thread Kumar Kartikeya Dwivedi
On Sat, Mar 27, 2021 at 04:55:51AM IST, Andrii Nakryiko wrote: > On Thu, Mar 25, 2021 at 5:01 AM Kumar Kartikeya Dwivedi > wrote: > > > > Update the header file so we can use the new defines in subsequent > > patches. > > > > Reviewed-by: Toke Høiland-Jørgensen

[PATCH v2 1/1] net: sched: bump refcount for new action in ACT replace mode

2021-03-29 Thread Kumar Kartikeya Dwivedi
, there is no existing action, so no tcf_exts_destroy callback happens. This means no code changes for CLS API. Fixes: cae422f379f3 ("net: sched: use reference counting action init") Signed-off-by: Kumar Kartikeya Dwivedi --- Changelog: v1 -> v2 Remove erroneous tcf_action_put_many call in tcf_

Re: [PATCH 1/1] net: sched: extend lifetime of new action in replace mode

2021-03-29 Thread Kumar Kartikeya Dwivedi
On Mon, Mar 29, 2021 at 02:35:12PM IST, Vlad Buslov wrote: > it seems that there are two ways actions are overwritten/deleted: > > 1. Directly through action API, which is still serialized by rtnl lock. > > 2. Classifier API, which doesn't use rtnl lock anymore and can execute > concurrently. > >

Re: [PATCH bpf-next 5/5] libbpf: add selftests for TC-BPF API

2021-03-28 Thread Kumar Kartikeya Dwivedi
On Mon, Mar 29, 2021 at 06:56:02AM IST, Alexei Starovoitov wrote: > This is up to you. I'm trying to understand the motivation for *_block() apis. > I'm not taking a stance for/against them. The block APIs simply attach to a different shared filter block, so in that sense they just forward to the

Re: [PATCH v2 1/1] net: sched: bump refcount for new action in ACT replace mode

2021-03-31 Thread Kumar Kartikeya Dwivedi
On Wed, Mar 31, 2021 at 10:10:45AM IST, Cong Wang wrote: > On Mon, Mar 29, 2021 at 3:55 PM Kumar Kartikeya Dwivedi > wrote: > > diff --git a/net/sched/act_api.c b/net/sched/act_api.c > > index b919826939e0..43cceb924976 100644 > > --- a/net/sched/act_api.c >

[PATCH net-next v3] net: sched: bump refcount for new action in ACT replace mode

2021-03-31 Thread Kumar Kartikeya Dwivedi
rence counting action init") Signed-off-by: Kumar Kartikeya Dwivedi --- Changelog: v2 -> v3 Cleanup new action on rollback after raising refcount (Cong) v1 -> v2 Remove erroneous tcf_action_put_many call in tcf_exts_validate (Vlad) Isolate refcount bump to ACT API in replace mode

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-03-31 Thread Kumar Kartikeya Dwivedi
On Wed, Mar 31, 2021 at 02:41:40AM IST, Toke Høiland-Jørgensen wrote: > Andrii Nakryiko writes: > > > On Sun, Mar 28, 2021 at 1:11 AM Kumar Kartikeya Dwivedi > > wrote: > >> > >> On Sun, Mar 28, 2021 at 10:12:40AM IST, Andrii Nakryiko wrote: > >>

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-03-31 Thread Kumar Kartikeya Dwivedi
On Wed, Mar 31, 2021 at 02:55:47AM IST, Daniel Borkmann wrote: > Do we even need the _block variant? I would rather prefer to take the chance > and make it as simple as possible, and only iff really needed extend with > other APIs, for example: The block variant can be dropped, I'll use the

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-06 Thread Kumar Kartikeya Dwivedi
On Mon, Apr 05, 2021 at 10:51:09PM IST, Andrii Nakryiko wrote: > > [...] > > if _block variant is just a special ifindex value, then it should be > fine for users to know such a detail (we can leave a comment > mentioning this specifically), especially given it's not a very > popular thing. Almost

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-02 Thread Kumar Kartikeya Dwivedi
On Fri, Apr 02, 2021 at 05:49:29AM IST, Daniel Borkmann wrote: > On 3/31/21 11:44 AM, Kumar Kartikeya Dwivedi wrote: > > On Wed, Mar 31, 2021 at 02:55:47AM IST, Daniel Borkmann wrote: > > > Do we even need the _block variant? I would rather prefer to take the > >

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-02 Thread Kumar Kartikeya Dwivedi
On Sat, Apr 03, 2021 at 12:02:14AM IST, Alexei Starovoitov wrote: > On Fri, Apr 2, 2021 at 8:27 AM Kumar Kartikeya Dwivedi > wrote: > > [...] > > All of these things are messy because of tc legacy. bpf tried to follow tc > style > with cls and act distinction and i

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-03-28 Thread Kumar Kartikeya Dwivedi
On Sun, Mar 28, 2021 at 10:12:40AM IST, Andrii Nakryiko wrote: > Is there some succinct but complete enough documentation/tutorial/etc > that I can reasonably read to understand kernel APIs provided by TC > (w.r.t. BPF, of course). I'm trying to wrap my head around this and > whether API makes

[PATCH 1/1] net: sched: extend lifetime of new action in replace mode

2021-03-28 Thread Kumar Kartikeya Dwivedi
to release the reference held during insertion. This is only needed in replace mode. We use a relaxed store as insert will ensure its visibility. Fixes: cae422f379f3 ("net: sched: use reference counting action init") Signed-off-by: Kumar Kartikeya Dwivedi --- include/net/act_api.h | 1 +

[PATCH] libbpf: use SOCK_CLOEXEC when opening the netlink socket

2021-03-17 Thread Kumar Kartikeya Dwivedi
Otherwise, there exists a small window between the opening and closing of the socket fd where it may leak into processes launched by some other thread. Signed-off-by: Kumar Kartikeya Dwivedi --- tools/lib/bpf/netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools

[PATCH bpf-next v2] libbpf: use SOCK_CLOEXEC when opening the netlink socket

2021-03-17 Thread Kumar Kartikeya Dwivedi
Otherwise, there exists a small window between the opening and closing of the socket fd where it may leak into processes launched by some other thread. Fixes: 949abbe88436 ("libbpf: add function to setup XDP") Signed-off-by: Kumar Kartikeya Dwivedi --- Changelog: v1 -> v2 Tag the

[PATCH bpf-next v2 2/4] libbpf: add helpers for preparing netlink attributes

2021-04-19 Thread Kumar Kartikeya Dwivedi
the open coded attribute preparation with the helpers. Note that the only failure the internal call to nlattr_add could result in the nested helper would be -EMSGSIZE, hence that is what we return to our caller. Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Kumar Kartikeya Dwivedi --- tools

[PATCH bpf-next v2 3/4] libbpf: add low level TC-BPF API

2021-04-19 Thread Kumar Kartikeya Dwivedi
assert(info.class_id == TC_H_MAKE(1UL << 16, 12)); This would be roughly equivalent to doing: # tc filter change dev lo egress prio handle bpf obj foo.o sec \ classifier classid 1:12 ... except a new bpf program will be loaded and replace existing one. Reviewed-by: Toke Høi

[PATCH bpf-next v2 4/4] libbpf: add selftests for TC-BPF API

2021-04-19 Thread Kumar Kartikeya Dwivedi
This adds some basic tests for the low level bpf_tc_cls_* API. Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Kumar Kartikeya Dwivedi --- .../selftests/bpf/prog_tests/test_tc_bpf.c| 112 ++ .../selftests/bpf/progs/test_tc_bpf_kern.c| 12 ++ 2 files changed, 124

[PATCH bpf-next v2 1/4] tools: pkt_cls.h: sync with kernel sources

2021-04-19 Thread Kumar Kartikeya Dwivedi
Update the header file so we can use the new defines in subsequent patches. Also make sure they remain up to date. Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Kumar Kartikeya Dwivedi --- tools/include/uapi/linux/pkt_cls.h | 174 - tools/lib/bpf/Makefile

[PATCH bpf-next v2 0/4] Add TC-BPF API

2021-04-19 Thread Kumar Kartikeya Dwivedi
set up, we skip the setup and move on with filter creation. * Other minor changes that came up during the course of discussion and rework. Kumar Kartikeya Dwivedi (4): tools: pkt_cls.h: sync with kernel sources libbpf: add helpers for preparing netlink attributes libbpf: add low level TC-

Re: [PATCH bpf-next v2 3/4] libbpf: add low level TC-BPF API

2021-04-19 Thread Kumar Kartikeya Dwivedi
On Tue, Apr 20, 2021 at 02:30:44AM IST, Daniel Borkmann wrote: > On 4/19/21 2:18 PM, Kumar Kartikeya Dwivedi wrote: > > This adds functions that wrap the netlink API used for adding, > > manipulating, and removing traffic control filters. These functions > > operate directly

Re: [PATCH 02/13] staging: greybus: Switch from strlcpy to strscpy

2021-02-16 Thread Kumar Kartikeya Dwivedi
On Tue, Feb 16, 2021 at 08:24:59PM IST, Alex Elder wrote: > This is a good change. But while you're at it, I would > appreciate if you would convert a few spots to use > sizeof(dest) rather than a fixed constant. I will > point them out below. > > If this is the *only* request for a change on

[PATCH] staging: emxx_udc: Fix incorrectly defined global

2021-02-06 Thread Kumar Kartikeya Dwivedi
it be static? Signed-off-by: Kumar Kartikeya Dwivedi --- drivers/staging/emxx_udc/emxx_udc.c | 3 +++ drivers/staging/emxx_udc/emxx_udc.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index a30b4f5b1

[PATCH v2] staging: emxx_udc: Make incorrectly defined global static

2021-02-07 Thread Kumar Kartikeya Dwivedi
-by: Kumar Kartikeya Dwivedi --- drivers/staging/emxx_udc/emxx_udc.c | 3 +++ drivers/staging/emxx_udc/emxx_udc.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index a30b4f5b1..3536c03ff 100644

[PATCH v3] staging: emxx_udc: Make incorrectly defined global static

2021-02-07 Thread Kumar Kartikeya Dwivedi
-by: Kumar Kartikeya Dwivedi --- Changes in v1: Switch to variable with static linkage instead of extern Changes in v2: Resend a versioned patch Changes in v3: Include version changelog below the marker --- drivers/staging/emxx_udc/emxx_udc.c | 3 +++ drivers/staging/emxx_udc/emxx_udc.h | 2 -- 2 files

Re: [PATCH] staging: emxx_udc: Fix incorrectly defined global

2021-02-06 Thread Kumar Kartikeya Dwivedi
21f8dab Mon Sep 17 00:00:00 2001 From: Kumar Kartikeya Dwivedi Date: Sun, 7 Feb 2021 12:53:39 +0530 Subject: [PATCH] staging: emxx_udc: Make incorrectly defined global static The global gpio_desc pointer and int vbus_irq were defined in the header, instead put the definitions in the translation

[PATCH] staging/greybus: eliminate use of NAME_SIZE for strings

2021-02-21 Thread Kumar Kartikeya Dwivedi
Instead, depend on the size of the destination buffer for easier refactoring. Signed-off-by: Kumar Kartikeya Dwivedi --- Hopefully, this is more thorough. The only cases left now are where the destination string is represented by a pointer, otherwise all call sites with a fixed sized buffer have