Subject: Re: [PATCH] nfc: st21nfca: Refactor EVT_TRANSACTION

From: Jakub Kicinski <[email-masked]>
Date: Tue, 29 Mar 2022 18:25:29 -0700

On Tue, 29 Mar 2022 12:54:31 -0500 Martin Faltesek wrote:
> EVT_TRANSACTION has four different bugs:
> 
> 1. First conditional has logical AND but should be OR. It should
>    always check if it isn't NFC_EVT_TRANSACTION_AID_TAG, then
>    bail.
> 
> 2. Potential under allocating memory:devm_kzalloc (skb->len - 2)
>    when the aid_len specified in the packet is less than the fixed
>    NFC_MAX_AID_LENGTH in struct nfc_evt_transaction. In addition,
>    aid_len is u32 in the data structure, and u8 in the packet,
>    under counting 3 more bytes.
> 
> 3. Memory leaks after kzalloc when returning error.
> 
> 4. The final conditional check is also incorrect, for the same reasons
>    explained in #2.

Any time you're tempted to write a list in your commit message the
chances are you should split the change into multiple patches.