public inbox for ofono@lists.linux.dev
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: Sean Nyekjaer <sean@geanix.com>, ofono@lists.linux.dev
Subject: Re: [PATCH] qmi: avoid free of non heap object
Date: Thu, 26 Jun 2025 10:11:34 -0500	[thread overview]
Message-ID: <3d248eee-86eb-4e92-bfbd-7b736545c0cb@gmail.com> (raw)
In-Reply-To: <20250626081625.1362728-1-sean@geanix.com>

Hi Sean,

On 6/26/25 3:16 AM, Sean Nyekjaer wrote:
> qmux_create_client_timeout() free's a non heap object, avoid calling
> __request_free() and inline free_request() instead.
> 
> In function 'l_free',
>      inlined from '__request_free' at drivers/qmimodem/qmi.c:293:3,
>      inlined from 'qmux_create_client_timeout' at drivers/qmimodem/qmi.c:1427:2:
> ell/util.c:124:9: warning: 'free' called on pointer 'user_data_6(D)' with nonzero offset 28 [-Wfree-nonheap-object]
>    124 |         free(ptr);
>        |         ^

Hmm, what tool is producing this output?

> ---
>   drivers/qmimodem/qmi.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
> index 5d2553c5..4468761a 100644
> --- a/drivers/qmimodem/qmi.c
> +++ b/drivers/qmimodem/qmi.c
> @@ -1424,7 +1424,9 @@ static void qmux_create_client_timeout(struct l_timeout *timeout,
>   
>   	/* remove request from queues */
>   	find_control_request(qmux, req->super.tid);
> -	__request_free(&req->super);
> +
> +	if (req->super.free_request)
> +		req->super.free_request(&req->super);

This must be some sort of false positive.  In qmi_qmux_device_create_client() we 
always set .free_request, so __request_free will never take the l_free() branch.

The question is whether a compiler is producing this output or some static 
analysis tool?

>   }
>   
>   static void qmux_create_client_callback(struct qmi_request *r,

Regards,
-Denis

  reply	other threads:[~2025-06-26 15:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-26  8:16 [PATCH] qmi: avoid free of non heap object Sean Nyekjaer
2025-06-26 15:11 ` Denis Kenzior [this message]
2025-06-26 17:52   ` Sean Nyekjaer
2025-06-27 21:20 ` patchwork-bot+ofono

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=3d248eee-86eb-4e92-bfbd-7b736545c0cb@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@lists.linux.dev \
    --cc=sean@geanix.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