All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Granados <j.granados@samsung.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: <oe-kbuild@lists.linux.dev>, <lkp@intel.com>,
	<oe-kbuild-all@lists.linux.dev>
Subject: Re: [joelgranados:jag/sysctl-testing-for-0day 2/6] drivers/parport/procfs.c:502 parport_proc_register() warn: possible memory leak of 't'
Date: Tue, 16 May 2023 16:05:20 +0200	[thread overview]
Message-ID: <20230516140520.cjlqqfhgrkk37pyg@localhost> (raw)
In-Reply-To: <98df279e-4558-40e7-ab96-0ab45ba5a16f@kili.mountain>

[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]

On Tue, May 16, 2023 at 10:05:54AM +0300, Dan Carpenter wrote:
> On Mon, May 15, 2023 at 08:59:17PM +0200, Joel Granados wrote:
> > On Mon, May 15, 2023 at 10:34:44AM +0300, Dan Carpenter wrote:
> > > 3756e44223c286 Joel Granados        2023-05-12  504  	if (register_sysctl(tmp_dir_path, t->device_dir) == NULL)
> > > 3756e44223c286 Joel Granados        2023-05-12  505  		/*
> > > 3756e44223c286 Joel Granados        2023-05-12  506  		 * We keep the original behavior of parport where failure to register
> > > 3756e44223c286 Joel Granados        2023-05-12  507  		 * does not return error.
> > > 3756e44223c286 Joel Granados        2023-05-12  508  		 */
> > > 3756e44223c286 Joel Granados        2023-05-12 @509  		goto  exit_free_tmp_dir_path;
> > > 
> > > Smatch wants a error code for this error path.
> > > 
> > > The comments say that we are doing the wrong thing deliberately to
> > > maintain backwards compatibility and avoid breaking stuff.  Fortunately,
> > > (LOL), no one is checking the returns from parport_proc_register() so we
> > > are free to return a correct error code without any worry about breakage.
> > Sigh. Indeed, the only place were this function is called is from
> > parport/share.c. Should we just change the function return value to
> > void?
> 
> I feel like we should return errors and not check for them.
> 
> Hopefully, some day in the future someone will be able to test this code
> and add checks.  (This seems more optimistic than realistic).
looked at this a bit more and saw that all the callers to
parport_announce_port (which is the only function that calls
parport_proc_register) have a concept of an erroneous flow.
In practice it would "just" be a matter of going throuh all these calls
and making parport_announce_port set the appropriate error handle and
return on error.

Hopefully someday, someone will push this :).

> 
> regards,
> dan carpenter
> 

-- 

Joel Granados

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2023-05-16 14:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230515073454eucas1p13d3f249160454d835f3cefce3fa7a0eb@eucas1p1.samsung.com>
2023-05-15  7:34 ` [joelgranados:jag/sysctl-testing-for-0day 2/6] drivers/parport/procfs.c:502 parport_proc_register() warn: possible memory leak of 't' Dan Carpenter
2023-05-15 18:59   ` Joel Granados
2023-05-16  7:05     ` Dan Carpenter
2023-05-16 14:05       ` Joel Granados [this message]
2023-05-15  1:38 kernel test robot

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=20230516140520.cjlqqfhgrkk37pyg@localhost \
    --to=j.granados@samsung.com \
    --cc=dan.carpenter@linaro.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /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.