* [PATCH v3] staging: r8188eu: fix too many leading tabs
@ 2022-09-19 13:23 Joash Naidoo
2022-09-24 11:04 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Joash Naidoo @ 2022-09-19 13:23 UTC (permalink / raw)
To: Larry.Finger, phil, paskripkin, dan.carpenter, gregkh
Cc: linux-staging, Joash Naidoo
Coding style fix. Fix too many leading tabs and line length.
Signed-off-by: Joash Naidoo <joash.n09@gmail.com>
---
Changes in v3:
- Fix flipped condition mistake
- move skb NULL check before dereferencing it
Changes in v2:
- Flip additional nested if conditions and don't reverse the last if statement
- Move declarations to start of function
- Separate converting __constant_htons to htons to another patch
---
drivers/staging/r8188eu/core/rtw_br_ext.c | 69 ++++++++++++-----------
1 file changed, 36 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index bca20fe5c..833488dd5 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -604,39 +604,42 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
if (!skb)
return;
- if (!priv->ethBrExtInfo.dhcp_bcst_disable) {
- __be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN));
-
- if (protocol == __constant_htons(ETH_P_IP)) { /* IP */
- struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN);
-
- if (iph->protocol == IPPROTO_UDP) { /* UDP */
- struct udphdr *udph = (struct udphdr *)((size_t)iph + (iph->ihl << 2));
-
- if ((udph->source == __constant_htons(CLIENT_PORT)) &&
- (udph->dest == __constant_htons(SERVER_PORT))) { /* DHCP request */
- struct dhcpMessage *dhcph =
- (struct dhcpMessage *)((size_t)udph + sizeof(struct udphdr));
- u32 cookie = be32_to_cpu((__be32)dhcph->cookie);
-
- if (cookie == DHCP_MAGIC) { /* match magic word */
- if (!(dhcph->flags & htons(BROADCAST_FLAG))) {
- /* if not broadcast */
- register int sum = 0;
-
- /* or BROADCAST flag */
- dhcph->flags |= htons(BROADCAST_FLAG);
- /* recalculate checksum */
- sum = ~(udph->check) & 0xffff;
- sum += be16_to_cpu(dhcph->flags);
- while (sum >> 16)
- sum = (sum & 0xffff) + (sum >> 16);
- udph->check = ~sum;
- }
- }
- }
- }
- }
+ __be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN));
+ struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN);
+ struct udphdr *udph = (struct udphdr *)((size_t)iph + (iph->ihl << 2));
+ /* DHCP request */
+ struct dhcpMessage *dhcph =
+ (struct dhcpMessage *)((size_t)udph + sizeof(struct udphdr));
+ u32 cookie = be32_to_cpu((__be32)dhcph->cookie);
+
+ if (priv->ethBrExtInfo.dhcp_bcst_disable)
+ return;
+
+ if (protocol != htons(ETH_P_IP)) /* IP */
+ return;
+
+ if (iph->protocol != IPPROTO_UDP) /* UDP */
+ return;
+
+ if ((udph->source != __constant_htons(CLIENT_PORT)) ||
+ (udph->dest != __constant_htons(SERVER_PORT)))
+ return;
+
+ if (cookie != DHCP_MAGIC) /* match magic word */
+ return;
+
+ if (!(dhcph->flags & htons(BROADCAST_FLAG))) {
+ /* if not broadcast */
+ register int sum = 0;
+
+ /* or BROADCAST flag */
+ dhcph->flags |= htons(BROADCAST_FLAG);
+ /* recalculate checksum */
+ sum = ~(udph->check) & 0xffff;
+ sum += be16_to_cpu(dhcph->flags);
+ while (sum >> 16)
+ sum = (sum & 0xffff) + (sum >> 16);
+ udph->check = ~sum;
}
}
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3] staging: r8188eu: fix too many leading tabs
2022-09-19 13:23 [PATCH v3] staging: r8188eu: fix too many leading tabs Joash Naidoo
@ 2022-09-24 11:04 ` Greg KH
2022-09-27 6:24 ` Joash Naidoo
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2022-09-24 11:04 UTC (permalink / raw)
To: Joash Naidoo; +Cc: Larry.Finger, phil, paskripkin, dan.carpenter, linux-staging
On Mon, Sep 19, 2022 at 03:23:10PM +0200, Joash Naidoo wrote:
> Coding style fix. Fix too many leading tabs and line length.
>
> Signed-off-by: Joash Naidoo <joash.n09@gmail.com>
> ---
> Changes in v3:
> - Fix flipped condition mistake
> - move skb NULL check before dereferencing it
> Changes in v2:
> - Flip additional nested if conditions and don't reverse the last if statement
> - Move declarations to start of function
> - Separate converting __constant_htons to htons to another patch
Always test-build your changes before sending them out so you do not get
grumpy emails from maintainers asking why you didn't test-build your
changes...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] staging: r8188eu: fix too many leading tabs
2022-09-24 11:04 ` Greg KH
@ 2022-09-27 6:24 ` Joash Naidoo
2022-09-27 7:04 ` Michael Straube
2022-09-27 7:05 ` Dan Carpenter
0 siblings, 2 replies; 5+ messages in thread
From: Joash Naidoo @ 2022-09-27 6:24 UTC (permalink / raw)
To: Greg KH; +Cc: Larry.Finger, phil, paskripkin, dan.carpenter, linux-staging
Greg KH <gregkh@linuxfoundation.org> writes:
> On Mon, Sep 19, 2022 at 03:23:10PM +0200, Joash Naidoo wrote:
>> Coding style fix. Fix too many leading tabs and line length.
>>
>> Signed-off-by: Joash Naidoo <joash.n09@gmail.com>
>> ---
>> Changes in v3:
>> - Fix flipped condition mistake
>> - move skb NULL check before dereferencing it
>> Changes in v2:
>> - Flip additional nested if conditions and don't reverse
>> the last if statement
>> - Move declarations to start of function
>> - Separate converting __constant_htons to htons to another
>> patch
>
> Always test-build your changes before sending them out so you do
> not get
> grumpy emails from maintainers asking why you didn't test-build
> your
> changes...
>
> thanks,
>
> greg k-h
Hi Greg,
Indeed building and testing is a vital step before sending
changes. Is this message referring to my V3 patch not building? Or
referring to my earlier versions?
Before sending I built my changes with:
make M=drivers/staging/r8188eu clean
make M=drivers/staging/r8188eu
I have a TP-Link Wifi dongle (Model: TL-WN725N) which I used to
test. I enabled the driver as module with make menuconfig, built,
installed (make modules_install && make install) and booted the
modified kernel image (vmlinuz-6.0.0-rc5+). Then I ensured my
wpa_supplicant service runs fine and then just checked if I could
still connect to Wifi and browse the web. (I understand this is
limited, since I didn't catch my error in V2) Furthermore, I also
ran:
dmesg -t -l crit
dmesg -t -l warn
dmesg -t -l err
I have only gotten the following relevant warning:
r8188eu: module is from the staging directory, the quality is
unknown, you have been warned.
If there is anything I still may be lacking, please advise. Thank
you for your support.
Kind Regards,
Joash
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] staging: r8188eu: fix too many leading tabs
2022-09-27 6:24 ` Joash Naidoo
@ 2022-09-27 7:04 ` Michael Straube
2022-09-27 7:05 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Michael Straube @ 2022-09-27 7:04 UTC (permalink / raw)
To: Joash Naidoo, Greg KH
Cc: Larry.Finger, phil, paskripkin, dan.carpenter, linux-staging
On 9/27/22 08:24, Joash Naidoo wrote:
>
> Greg KH <gregkh@linuxfoundation.org> writes:
>
>> On Mon, Sep 19, 2022 at 03:23:10PM +0200, Joash Naidoo wrote:
>>> Coding style fix. Fix too many leading tabs and line length.
>>>
>>> Signed-off-by: Joash Naidoo <joash.n09@gmail.com>
>>> ---
>>> Changes in v3:
>>> - Fix flipped condition mistake
>>> - move skb NULL check before dereferencing it
>>> Changes in v2:
>>> - Flip additional nested if conditions and don't reverse the
>>> last if statement
>>> - Move declarations to start of function
>>> - Separate converting __constant_htons to htons to another patch
>>
>> Always test-build your changes before sending them out so you do not get
>> grumpy emails from maintainers asking why you didn't test-build your
>> changes...
>>
>> thanks,
>>
>> greg k-h
> Hi Greg,
>
> Indeed building and testing is a vital step before sending
> changes. Is this message referring to my V3 patch not building? Or
> referring to my earlier versions?
>
Hi Joash,
v3 introduces a gcc warning.
drivers/staging/r8188eu/core/rtw_br_ext.c: In function 'dhcp_flag_bcast':
drivers/staging/r8188eu/core/rtw_br_ext.c:606:9: warning: ISO C90
forbids mixed declarations and code [-Wdeclaration-after-statement]
606 | __be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN));
| ^~~~~~
regards,
Michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] staging: r8188eu: fix too many leading tabs
2022-09-27 6:24 ` Joash Naidoo
2022-09-27 7:04 ` Michael Straube
@ 2022-09-27 7:05 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-09-27 7:05 UTC (permalink / raw)
To: Joash Naidoo; +Cc: Greg KH, Larry.Finger, phil, paskripkin, linux-staging
On Tue, Sep 27, 2022 at 08:24:01AM +0200, Joash Naidoo wrote:
>
> Greg KH <gregkh@linuxfoundation.org> writes:
>
> > On Mon, Sep 19, 2022 at 03:23:10PM +0200, Joash Naidoo wrote:
> > > Coding style fix. Fix too many leading tabs and line length.
> > >
> > > Signed-off-by: Joash Naidoo <joash.n09@gmail.com>
> > > ---
> > > Changes in v3:
> > > - Fix flipped condition mistake
> > > - move skb NULL check before dereferencing it
> > > Changes in v2:
> > > - Flip additional nested if conditions and don't reverse the
> > > last if statement
> > > - Move declarations to start of function
> > > - Separate converting __constant_htons to htons to another
> > > patch
> >
> > Always test-build your changes before sending them out so you do not get
> > grumpy emails from maintainers asking why you didn't test-build your
> > changes...
> >
> > thanks,
> >
> > greg k-h
> Hi Greg,
>
> Indeed building and testing is a vital step before sending
> changes. Is this message referring to my V3 patch not building? Or
> referring to my earlier versions?
>
> Before sending I built my changes with:
>
> make M=drivers/staging/r8188eu clean
> make M=drivers/staging/r8188eu
>
CC [M] drivers/staging/r8188eu/core/rtw_br_ext.o
drivers/staging/r8188eu/core/rtw_br_ext.c: In function ‘dhcp_flag_bcast’:
drivers/staging/r8188eu/core/rtw_br_ext.c:607:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
607 | __be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN));
| ^~~~~~
cc1: all warnings being treated as errors
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-27 7:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 13:23 [PATCH v3] staging: r8188eu: fix too many leading tabs Joash Naidoo
2022-09-24 11:04 ` Greg KH
2022-09-27 6:24 ` Joash Naidoo
2022-09-27 7:04 ` Michael Straube
2022-09-27 7:05 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).