All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk,
	gregkh@linuxfoundation.org, straube.linux@gmail.com,
	fmdefrancesco@gmail.com, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: r8188eu: fix type mismacth
Date: Mon, 6 Sep 2021 18:59:57 +0300	[thread overview]
Message-ID: <0f13057d-f33a-9efa-4cae-937169abbcd8@gmail.com> (raw)
In-Reply-To: <20210906065650.GD1957@kadam>

On 9/6/21 09:56, Dan Carpenter wrote:
> On Sun, Sep 05, 2021 at 11:52:16PM +0300, Pavel Skripkin wrote:
>> smatch says:
>> rtw_cmd.c:1165 rtw_setassocsta_cmd() warn: struct type mismatch 'set_stakey_rsp vs set_assocsta_rsp'
>> 
>> Since psetassocsta_rsp has struct set_stakey_rsp * type, it looks like
>> copy-paste failure. This error didn't cause any bugs, because
>> sizeof(struct set_assocsta_parm) > sizeof(struct set_stakey_rsp), but
>> there is no reason for allocation extra unused memory
>> 
>> Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
>> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
>> ---
>>  drivers/staging/r8188eu/core/rtw_cmd.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
>> index fee4208dacba..afe6c7fa594d 100644
>> --- a/drivers/staging/r8188eu/core/rtw_cmd.c
>> +++ b/drivers/staging/r8188eu/core/rtw_cmd.c
>> @@ -1162,7 +1162,7 @@ u8 rtw_setassocsta_cmd(struct adapter  *padapter, u8 *mac_addr)
>>  		goto exit;
>>  	}
>>  
>> -	psetassocsta_rsp = kzalloc(sizeof(struct set_assocsta_rsp), GFP_ATOMIC);
>> +	psetassocsta_rsp = kzalloc(sizeof(struct set_stakey_rsp), GFP_ATOMIC);
>>  	if (!psetassocsta_rsp) {
>>  		kfree(ph2c);
>>  		kfree(psetassocsta_para);
> 
> I'm not sure this is correct.  Might be, might be not.  But we use
> sizeof(struct set_assocsta_rsp) later in the function so it likely leads
> to memory corruption.
> 
>          ph2c->rsp = (u8 *)psetassocsta_rsp;
>          ph2c->rspsz = sizeof(struct set_assocsta_rsp);
> 

Hi, Dan!


Unfortunately, this function is unused, so I will just remove it in v2 :)


With regards,
Pavel Skripkin

  reply	other threads:[~2021-09-06 16:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05 20:52 [PATCH] staging: r8188eu: fix type mismacth Pavel Skripkin
2021-09-05 21:40 ` Michael Straube
2021-09-06  6:56 ` Dan Carpenter
2021-09-06 15:59   ` Pavel Skripkin [this message]
2021-09-06  9:44 ` Greg KH

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=0f13057d-f33a-9efa-4cae-937169abbcd8@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=dan.carpenter@oracle.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@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 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.