On 20.05.24 16:32, nanfengwq@xxxxxxxx wrote:
hello: In embedded devices with relatively small memory, if the transfer speed of ncm is fast and other programs occupy CPU memory, it is likely that the return value ncm ->skd_tx_data of alloc_skb() is NULL, and the code is likely to enter err. If skb2 is not processed in err, it will cause memory leakage.
Hi, apart from the submission process, could you please explain how this condition may happem? if (skb) { [..] if (ncm->skb_tx_data We know ncm->skb_tx_data != NULL && skb != NULL && (ncm->ndp_dgram_count >= TX_MAX_NUM_DPE || (ncm->skb_tx_data->len + div + rem + skb->len + ncm->skb_tx_ndp->len + ndp_align + (2 * dgram_idx_len)) > max_size)) { skb2 = package_for_tx(ncm); if (!ncm->skb_tx_data) { We know ncm->skb_tx_data == NULL && skb != NULL /* Create a new skb for the NTH and datagrams. */ ncm->skb_tx_data = alloc_skb(max_size, GFP_ATOMIC); if (!ncm->skb_tx_data) goto err; It seems to me that either skb2 = package_for_tx(ncm); or ncm->skb_tx_data = alloc_skb(max_size, GFP_ATOMIC); can be executed. The code paths seem to be mutually exclusive. Regards Oliver