linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
To: christophe.ricard@gmail.com, sameo@linux.intel.com,
	lauro.venancio@openbossa.org, aloisio.almeida@openbossa.org
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] NFC: st21nfca: fix st21nfca_get_iso14443_3_uid data copy
Date: Mon, 16 Mar 2015 20:28:36 +0800	[thread overview]
Message-ID: <5506CC74.107@m4x.org> (raw)
In-Reply-To: <1425358732-31752-1-git-send-email-nicolas.iooss_linux@m4x.org>

Hello,
I have not received any comments about this patch so I'm sending it
again.  Could you please review it?

Nicolas

On 03/03/2015 12:58 PM, Nicolas Iooss wrote:
> st21nfca_get_iso14443_3_uid() does not correctly copy the uid from
> uid_skb->data to its gate parameter.  "gate = uid_skb->data;" only puts
> a pointer to uid_skb->data to the local variable gate.  This means that
> in st21nfca_hci_target_from_gate() the content of "u8
> uid[NFC_NFCID1_MAXSIZE]" local variable is never initialized before
> being used in memcpy(target->nfcid1, uid, len).
> 
> Fix this by replacing the local variable assignment with a memcpy.
> 
> This was found by compiling Linux with "gcc -Wunused-but-set-parameter".
> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> ---
> 
> As I did not get any reply from https://lkml.org/lkml/2015/2/28/25 and
> got confirmation by other people that this may be a real bug, I am now
> sending a patch to fix it.
> 
>  drivers/nfc/st21nfca/st21nfca.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nfc/st21nfca/st21nfca.c b/drivers/nfc/st21nfca/st21nfca.c
> index 24d3d240d5f4..ff70d2838b29 100644
> --- a/drivers/nfc/st21nfca/st21nfca.c
> +++ b/drivers/nfc/st21nfca/st21nfca.c
> @@ -588,7 +588,7 @@ static int st21nfca_get_iso14443_3_uid(struct nfc_hci_dev *hdev, u8 *gate,
>  		goto exit;
>  	}
>  
> -	gate = uid_skb->data;
> +	memcpy(gate, uid_skb->data, uid_skb->len);
>  	*len = uid_skb->len;
>  exit:
>  	kfree_skb(uid_skb);
> 

  reply	other threads:[~2015-03-16 12:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-28  8:41 Invalid assignment to gate in st21nfca_get_iso14443_3_uid Nicolas Iooss
2015-03-03  4:58 ` [PATCH] NFC: st21nfca: fix st21nfca_get_iso14443_3_uid data copy Nicolas Iooss
2015-03-16 12:28   ` Nicolas Iooss [this message]
2015-03-16 17:51     ` christophe.ricard

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=5506CC74.107@m4x.org \
    --to=nicolas.iooss_linux@m4x.org \
    --cc=aloisio.almeida@openbossa.org \
    --cc=christophe.ricard@gmail.com \
    --cc=lauro.venancio@openbossa.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sameo@linux.intel.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;
as well as URLs for NNTP newsgroup(s).