mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: Wang Cheng <wanngchenng@gmail.com>
Cc: dan.carpenter@oracle.com, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] staging: rtl8712: fix uninit-value in r871xu_drv_init()
Date: Fri, 6 May 2022 15:02:05 +0300	[thread overview]
Message-ID: <a5483e41-b5f7-d86b-21b9-2a9c3e602855@gmail.com> (raw)
In-Reply-To: <20220506113320.gc6zryhm7uqnbva5@ppc.localdomain>


[-- Attachment #1.1: Type: text/plain, Size: 1953 bytes --]

Hi Wang,

On 5/6/22 14:33, Wang Cheng wrote:
> On 22/05/06 10:41AM, Pavel Skripkin wrote:
>> Hi Wang,
>> 
>> On 5/6/22 06:16, Wang Cheng wrote:
>> 
>> [snip]
>> 
>> > 
>> > Reported-and-tested-by: syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com
>> > Signed-off-by: Wang Cheng <wanngchenng@gmail.com>
>> > ---
>> >   drivers/staging/rtl8712/usb_intf.c | 6 +++---
>> >   1 file changed, 3 insertions(+), 3 deletions(-)
>> > 
>> > diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
>> > index ee4c61f85a07..50dcd3ecb685 100644
>> > --- a/drivers/staging/rtl8712/usb_intf.c
>> > +++ b/drivers/staging/rtl8712/usb_intf.c
>> > @@ -538,13 +538,13 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
>> >   		} else {
>> >   			AutoloadFail = false;
>> >   		}
>> > -		if (((mac[0] == 0xff) && (mac[1] == 0xff) &&
>> > +		if ((!AutoloadFail) ||
>> > +		    ((mac[0] == 0xff) && (mac[1] == 0xff) &&
>> >   		     (mac[2] == 0xff) && (mac[3] == 0xff) &&
>> >   		     (mac[4] == 0xff) && (mac[5] == 0xff)) ||
>> >   		    ((mac[0] == 0x00) && (mac[1] == 0x00) &&
>> >   		     (mac[2] == 0x00) && (mac[3] == 0x00) &&
>> > -		     (mac[4] == 0x00) && (mac[5] == 0x00)) ||
>> > -		     (!AutoloadFail)) {
>> > +		     (mac[4] == 0x00) && (mac[5] == 0x00))) {
>> 
>> 
>> That looks ugly. I mean mac checks. Can we, please, use sane kernel API like
>> is_valid_ether_addr()?
> 
> Good idea! But will is_valid_ether_addr() check a larger range?
> The comment of is_valid_ether_addr()(include/linux/etherdevice.h) says:
>    Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
>    a *multicast address*, and is not FF:FF:FF:FF:FF:FF.
> 

I am not good an expert at networking stuff, but can multicast mac 
address be valid for purpose of Wi-Fi adapter? IIUC it's can't, but as I 
said before, I am not an expert



With regards,
Pavel Skripkin

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  parent reply	other threads:[~2022-05-06 12:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06  3:13 [PATCH v2 0/2] staging: rtl8712: fix uninit-value 'data' and 'mac' Wang Cheng
2022-05-06  3:15 ` [PATCH v2 1/2] staging: rtl8712: fix uninit-value in usb_read8() and friends Wang Cheng
2022-05-06  7:10   ` Dan Carpenter
2022-05-06 11:22     ` Wang Cheng
2022-05-06  7:23   ` Pavel Skripkin
2022-05-06  7:57     ` Dan Carpenter
2022-05-06  3:16 ` [PATCH v2 2/2] staging: rtl8712: fix uninit-value in r871xu_drv_init() Wang Cheng
2022-05-06  7:41   ` Pavel Skripkin
2022-05-06 11:33     ` Wang Cheng
2022-05-06 11:56       ` Wang Cheng
2022-05-06 12:02       ` Pavel Skripkin [this message]
2022-05-09  4:03         ` Wang Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5483e41-b5f7-d86b-21b9-2a9c3e602855@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=wanngchenng@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®