From: Alex Elder <hidden> Date: 2021-02-01 23:27:20
This series fixes four minor bugs. The first two are things that
sparse points out. All four are very simple and each patch should
explain itself pretty well.
-Alex
Alex Elder (4):
net: ipa: add a missing __iomem attribute
net: ipa: be explicit about endianness
net: ipa: use the right accessor in ipa_endpoint_status_skip()
net: ipa: fix two format specifier errors
drivers/net/ipa/gsi.c | 2 +-
drivers/net/ipa/ipa_endpoint.c | 6 +++---
drivers/net/ipa/ipa_mem.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
--
2.27.0
From: Alex Elder <hidden> Date: 2021-02-01 23:27:21
The virt local variable in gsi_channel_state() does not have an
__iomem attribute but should. Fix this.
Signed-off-by: Alex Elder <redacted>
---
drivers/net/ipa/gsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Mon, Feb 1, 2021 at 3:29 PM Alex Elder [off-list ref] wrote:
quoted hunk
The virt local variable in gsi_channel_state() does not have an
__iomem attribute but should. Fix this.
Signed-off-by: Alex Elder <redacted>
---
drivers/net/ipa/gsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Alex Elder <hidden> Date: 2021-02-01 23:28:03
Sparse warns that the assignment of the metadata mask for a QMAP
endpoint in ipa_endpoint_init_hdr_metadata_mask() is a bad
assignment. We know we want the mask value to be big endian, even
though the value we write is in host byte order. Use a __force
tag to indicate we really mean it.
Signed-off-by: Alex Elder <redacted>
---
drivers/net/ipa/ipa_endpoint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Alex Elder <hidden> Date: 2021-02-01 23:28:04
Fix two format specifiers that used %lu for a size_t in "ipa_mem.c".
Signed-off-by: Alex Elder <redacted>
---
drivers/net/ipa/ipa_mem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Alex Elder <hidden> Date: 2021-02-01 23:28:43
When extracting the destination endpoint ID from the status in
ipa_endpoint_status_skip(), u32_get_bits() is used. This happens to
work, but it's wrong: the structure field is only 8 bits wide
instead of 32.
Fix this by using u8_get_bits() to get the destination endpoint ID.
Signed-off-by: Alex Elder <redacted>
---
drivers/net/ipa/ipa_endpoint.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
On Mon, Feb 1, 2021 at 3:32 PM Alex Elder [off-list ref] wrote:
When extracting the destination endpoint ID from the status in
ipa_endpoint_status_skip(), u32_get_bits() is used. This happens to
work, but it's wrong: the structure field is only 8 bits wide
instead of 32.
Fix this by using u8_get_bits() to get the destination endpoint ID.
A few lines above this, endpoint_id is initialized as u32. If we're
going for "correctness", endpoint_id should be a u8. But of course,
this would contrast with ipa_endpoint having it as a u32.
As far as I see it, using u32_get_bits instead of u8_get_bits simply
eliminates confusion about the type of endpoint_id. Perhaps instead of
this patch, send a patch with a comment that while u32_get_bits is
used, the field is only 8 bits?
Best regards,
Amy Parker
(she/her/hers)
On Mon, Feb 1, 2021 at 4:02 PM Amy Parker [off-list ref] wrote:
quoted
Fix this by using u8_get_bits() to get the destination endpoint ID.
Isn't
Apologies about this - premature email sending. This was simply going
to be "Isn't endpoint_id u32?", which was addressed later anyways.
Best regards,
Amy Parker
(she/her/hers)
From: Alex Elder <hidden> Date: 2021-02-02 00:16:47
On 2/1/21 6:02 PM, Amy Parker wrote:
On Mon, Feb 1, 2021 at 3:32 PM Alex Elder [off-list ref] wrote:
quoted
When extracting the destination endpoint ID from the status in
ipa_endpoint_status_skip(), u32_get_bits() is used. This happens to
work, but it's wrong: the structure field is only 8 bits wide
instead of 32.
Fix this by using u8_get_bits() to get the destination endpoint ID.
A few lines above this, endpoint_id is initialized as u32. If we're
going for "correctness", endpoint_id should be a u8. But of course,
this would contrast with ipa_endpoint having it as a u32.
You are correct, endpoint_id is *defined* as type u32.
But the issue here is that the field status->endp_dst_idx
has type u8. u32_get_bits() assumes the field it is
passed has type u32; while u8_get_bits() takes a u8.
The return value of u8_get_bits() is u8, as you might
suspect. The C standard guarantees that the u8 value
will be promoted to the u32 target type here.
As far as I see it, using u32_get_bits instead of u8_get_bits simply
eliminates confusion about the type of endpoint_id. Perhaps instead of
this patch, send a patch with a comment that while u32_get_bits is
used, the field is only 8 bits?
No. We really want to extract a sub-field from the u8
value passed to u8_get_bits() (not u32_get_bits()).
Does that make sense?
-Alex
On Mon, Feb 1, 2021 at 4:15 PM Alex Elder [off-list ref] wrote:
On 2/1/21 6:02 PM, Amy Parker wrote:
quoted
On Mon, Feb 1, 2021 at 3:32 PM Alex Elder [off-list ref] wrote:
quoted
When extracting the destination endpoint ID from the status in
ipa_endpoint_status_skip(), u32_get_bits() is used. This happens to
work, but it's wrong: the structure field is only 8 bits wide
instead of 32.
Fix this by using u8_get_bits() to get the destination endpoint ID.
A few lines above this, endpoint_id is initialized as u32. If we're
going for "correctness", endpoint_id should be a u8. But of course,
this would contrast with ipa_endpoint having it as a u32.
You are correct, endpoint_id is *defined* as type u32.
But the issue here is that the field status->endp_dst_idx
has type u8. u32_get_bits() assumes the field it is
passed has type u32; while u8_get_bits() takes a u8.
Ah, missed that bit. Thanks for clarifying.
The return value of u8_get_bits() is u8, as you might
suspect. The C standard guarantees that the u8 value
will be promoted to the u32 target type here.
Yes, it does, and so it wouldn't be a theoretical issue - just an
issue of developer confusion at first when working with it. But the
above outlined point of the types taken is more important.
As far as I see it, using u32_get_bits instead of u8_get_bits simply
eliminates confusion about the type of endpoint_id. Perhaps instead of
this patch, send a patch with a comment that while u32_get_bits is
used, the field is only 8 bits?
No. We really want to extract a sub-field from the u8
value passed to u8_get_bits() (not u32_get_bits()).
Does that make sense?
-Alex
Yes, it does. Thank you.
Best regards,
Amy Parker
(she/her/hers)
Hello:
This series was applied to netdev/net.git (refs/heads/master):
On Mon, 1 Feb 2021 17:26:05 -0600 you wrote:
This series fixes four minor bugs. The first two are things that
sparse points out. All four are very simple and each patch should
explain itself pretty well.
-Alex
Alex Elder (4):
net: ipa: add a missing __iomem attribute
net: ipa: be explicit about endianness
net: ipa: use the right accessor in ipa_endpoint_status_skip()
net: ipa: fix two format specifier errors
[...]