All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v2] bpf: Fix a few typos in BPF helpers documentation
@ 2022-08-25 11:02 Quentin Monnet
  2022-08-25 14:22 ` Jakub Wilk
  2022-08-25 14:57 ` Alexei Starovoitov
  0 siblings, 2 replies; 5+ messages in thread
From: Quentin Monnet @ 2022-08-25 11:02 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf,
	Quentin Monnet, Alejandro Colomar, Jakub Wilk,
	Jesper Dangaard Brouer, linux-man

Address a few typos in the documentation for the BPF helper functions.
They were reported by Jakub [0], who ran spell checkers on the generated
man page [1].

Sync-up the UAPI header with its version in tools/.

[0] https://lore.kernel.org/linux-man/d22dcd47-023c-8f52-d369-7b5308e6c842@gmail.com/T/#mb02e7d4b7fb61d98fa914c77b581184e9a9537af
[1] https://lore.kernel.org/linux-man/eb6a1e41-c48e-ac45-5154-ac57a2c76108@gmail.com/T/#m4a8d1b003616928013ffcd1450437309ab652f9f

v2: Turn a ',' into a ';'

Cc: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Jakub Wilk <jwilk@jwilk.net>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: linux-man@vger.kernel.org
Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
---
 include/uapi/linux/bpf.h       | 16 ++++++++--------
 tools/include/uapi/linux/bpf.h | 18 +++++++++---------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 644600dbb114..0487ee06edef 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -4437,7 +4437,7 @@ union bpf_attr {
  *
  *		**-EEXIST** if the option already exists.
  *
- *		**-EFAULT** on failrue to parse the existing header options.
+ *		**-EFAULT** on failure to parse the existing header options.
  *
  *		**-EPERM** if the helper cannot be used under the current
  *		*skops*\ **->op**.
@@ -4646,7 +4646,7 @@ union bpf_attr {
  *		a *map* with *task* as the **key**.  From this
  *		perspective,  the usage is not much different from
  *		**bpf_map_lookup_elem**\ (*map*, **&**\ *task*) except this
- *		helper enforces the key must be an task_struct and the map must also
+ *		helper enforces the key must be a task_struct and the map must also
  *		be a **BPF_MAP_TYPE_TASK_STORAGE**.
  *
  *		Underneath, the value is stored locally at *task* instead of
@@ -4704,7 +4704,7 @@ union bpf_attr {
  *
  * long bpf_ima_inode_hash(struct inode *inode, void *dst, u32 size)
  *	Description
- *		Returns the stored IMA hash of the *inode* (if it's avaialable).
+ *		Returns the stored IMA hash of the *inode* (if it's available).
  *		If the hash is larger than *size*, then only *size*
  *		bytes will be copied to *dst*
  *	Return
@@ -4728,12 +4728,12 @@ union bpf_attr {
  *
  *		The argument *len_diff* can be used for querying with a planned
  *		size change. This allows to check MTU prior to changing packet
- *		ctx. Providing an *len_diff* adjustment that is larger than the
+ *		ctx. Providing a *len_diff* adjustment that is larger than the
  *		actual packet size (resulting in negative packet size) will in
- *		principle not exceed the MTU, why it is not considered a
- *		failure.  Other BPF-helpers are needed for performing the
- *		planned size change, why the responsability for catch a negative
- *		packet size belong in those helpers.
+ *		principle not exceed the MTU, which is why it is not considered
+ *		a failure.  Other BPF helpers are needed for performing the
+ *		planned size change; therefore the responsibility for catching
+ *		a negative packet size belongs in those helpers.
  *
  *		Specifying *ifindex* zero means the MTU check is performed
  *		against the current net device.  This is practical if this isn't
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 4fb685591035..0487ee06edef 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -79,7 +79,7 @@ struct bpf_insn {
 /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
 struct bpf_lpm_trie_key {
 	__u32	prefixlen;	/* up to 32 for AF_INET, 128 for AF_INET6 */
-	__u8	data[0];	/* Arbitrary size */
+	__u8	data[];	/* Arbitrary size */
 };
 
 struct bpf_cgroup_storage_key {
@@ -4437,7 +4437,7 @@ union bpf_attr {
  *
  *		**-EEXIST** if the option already exists.
  *
- *		**-EFAULT** on failrue to parse the existing header options.
+ *		**-EFAULT** on failure to parse the existing header options.
  *
  *		**-EPERM** if the helper cannot be used under the current
  *		*skops*\ **->op**.
@@ -4646,7 +4646,7 @@ union bpf_attr {
  *		a *map* with *task* as the **key**.  From this
  *		perspective,  the usage is not much different from
  *		**bpf_map_lookup_elem**\ (*map*, **&**\ *task*) except this
- *		helper enforces the key must be an task_struct and the map must also
+ *		helper enforces the key must be a task_struct and the map must also
  *		be a **BPF_MAP_TYPE_TASK_STORAGE**.
  *
  *		Underneath, the value is stored locally at *task* instead of
@@ -4704,7 +4704,7 @@ union bpf_attr {
  *
  * long bpf_ima_inode_hash(struct inode *inode, void *dst, u32 size)
  *	Description
- *		Returns the stored IMA hash of the *inode* (if it's avaialable).
+ *		Returns the stored IMA hash of the *inode* (if it's available).
  *		If the hash is larger than *size*, then only *size*
  *		bytes will be copied to *dst*
  *	Return
@@ -4728,12 +4728,12 @@ union bpf_attr {
  *
  *		The argument *len_diff* can be used for querying with a planned
  *		size change. This allows to check MTU prior to changing packet
- *		ctx. Providing an *len_diff* adjustment that is larger than the
+ *		ctx. Providing a *len_diff* adjustment that is larger than the
  *		actual packet size (resulting in negative packet size) will in
- *		principle not exceed the MTU, why it is not considered a
- *		failure.  Other BPF-helpers are needed for performing the
- *		planned size change, why the responsability for catch a negative
- *		packet size belong in those helpers.
+ *		principle not exceed the MTU, which is why it is not considered
+ *		a failure.  Other BPF helpers are needed for performing the
+ *		planned size change; therefore the responsibility for catching
+ *		a negative packet size belongs in those helpers.
  *
  *		Specifying *ifindex* zero means the MTU check is performed
  *		against the current net device.  This is practical if this isn't
-- 
2.34.1


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

* Re: [PATCH bpf-next v2] bpf: Fix a few typos in BPF helpers documentation
  2022-08-25 11:02 [PATCH bpf-next v2] bpf: Fix a few typos in BPF helpers documentation Quentin Monnet
@ 2022-08-25 14:22 ` Jakub Wilk
  2022-08-25 14:48   ` Quentin Monnet
  2022-08-25 14:57 ` Alexei Starovoitov
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Wilk @ 2022-08-25 14:22 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf,
	Alejandro Colomar, Jesper Dangaard Brouer, linux-man

* Quentin Monnet <quentin@isovalent.com>, 2022-08-25 12:02:
>--- a/tools/include/uapi/linux/bpf.h
>+++ b/tools/include/uapi/linux/bpf.h
>@@ -79,7 +79,7 @@ struct bpf_insn {
> /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
> struct bpf_lpm_trie_key {
> 	__u32	prefixlen;	/* up to 32 for AF_INET, 128 for AF_INET6 */
>-	__u8	data[0];	/* Arbitrary size */
>+	__u8	data[];	/* Arbitrary size */
> };

This hunk picks the change from 94dfc73e7cf4 ("treewide: uapi: Replace 
zero-length arrays with flexible-array members").

A bit weird to see it in a spelling-fix patch though. Wouldn't it be 
better to put it in a separate one?

-- 
Jakub Wilk

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

* Re: [PATCH bpf-next v2] bpf: Fix a few typos in BPF helpers documentation
  2022-08-25 14:22 ` Jakub Wilk
@ 2022-08-25 14:48   ` Quentin Monnet
  0 siblings, 0 replies; 5+ messages in thread
From: Quentin Monnet @ 2022-08-25 14:48 UTC (permalink / raw)
  To: Jakub Wilk
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf,
	Alejandro Colomar, Jesper Dangaard Brouer, linux-man

On 25/08/2022 15:22, Jakub Wilk wrote:
> * Quentin Monnet <quentin@isovalent.com>, 2022-08-25 12:02:
>> --- a/tools/include/uapi/linux/bpf.h
>> +++ b/tools/include/uapi/linux/bpf.h
>> @@ -79,7 +79,7 @@ struct bpf_insn {
>> /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
>> struct bpf_lpm_trie_key {
>>     __u32    prefixlen;    /* up to 32 for AF_INET, 128 for AF_INET6 */
>> -    __u8    data[0];    /* Arbitrary size */
>> +    __u8    data[];    /* Arbitrary size */
>> };
> 
> This hunk picks the change from 94dfc73e7cf4 ("treewide: uapi: Replace
> zero-length arrays with flexible-array members").
> 
> A bit weird to see it in a spelling-fix patch though. Wouldn't it be
> better to put it in a separate one?
> 

This has happened several times in the past, and the change is small
enough I thought it wouldn't matter much. I can send another version if
it's more convenient, though.

Quentin

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

* Re: [PATCH bpf-next v2] bpf: Fix a few typos in BPF helpers documentation
  2022-08-25 11:02 [PATCH bpf-next v2] bpf: Fix a few typos in BPF helpers documentation Quentin Monnet
  2022-08-25 14:22 ` Jakub Wilk
@ 2022-08-25 14:57 ` Alexei Starovoitov
  2022-08-25 15:23   ` Quentin Monnet
  1 sibling, 1 reply; 5+ messages in thread
From: Alexei Starovoitov @ 2022-08-25 14:57 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf,
	Alejandro Colomar, Jakub Wilk, Jesper Dangaard Brouer, linux-man

On Thu, Aug 25, 2022 at 4:02 AM Quentin Monnet <quentin@isovalent.com> wrote:
> index 4fb685591035..0487ee06edef 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -79,7 +79,7 @@ struct bpf_insn {
>  /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
>  struct bpf_lpm_trie_key {
>         __u32   prefixlen;      /* up to 32 for AF_INET, 128 for AF_INET6 */
> -       __u8    data[0];        /* Arbitrary size */
> +       __u8    data[]; /* Arbitrary size */

Sigh. Looks like you didn't even run the build of selftests.
Please see relevant commits in bpf tree.

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

* Re: [PATCH bpf-next v2] bpf: Fix a few typos in BPF helpers documentation
  2022-08-25 14:57 ` Alexei Starovoitov
@ 2022-08-25 15:23   ` Quentin Monnet
  0 siblings, 0 replies; 5+ messages in thread
From: Quentin Monnet @ 2022-08-25 15:23 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf,
	Alejandro Colomar, Jakub Wilk, Jesper Dangaard Brouer, linux-man

On 25/08/2022 15:57, Alexei Starovoitov wrote:
> On Thu, Aug 25, 2022 at 4:02 AM Quentin Monnet <quentin@isovalent.com> wrote:
>> index 4fb685591035..0487ee06edef 100644
>> --- a/tools/include/uapi/linux/bpf.h
>> +++ b/tools/include/uapi/linux/bpf.h
>> @@ -79,7 +79,7 @@ struct bpf_insn {
>>  /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
>>  struct bpf_lpm_trie_key {
>>         __u32   prefixlen;      /* up to 32 for AF_INET, 128 for AF_INET6 */
>> -       __u8    data[0];        /* Arbitrary size */
>> +       __u8    data[]; /* Arbitrary size */
> 
> Sigh. Looks like you didn't even run the build of selftests.
> Please see relevant commits in bpf tree.

The rest of the patch is a fix on typos, in comments, so indeed I did
not :/. I missed the commit from Daniel and should have been more
cautious about the above, apologies. I'll send a new version without it.

Quentin

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

end of thread, other threads:[~2022-08-25 15:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 11:02 [PATCH bpf-next v2] bpf: Fix a few typos in BPF helpers documentation Quentin Monnet
2022-08-25 14:22 ` Jakub Wilk
2022-08-25 14:48   ` Quentin Monnet
2022-08-25 14:57 ` Alexei Starovoitov
2022-08-25 15:23   ` Quentin Monnet

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.