From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: v4l2-fwnode: Improve exception handling in v4l2_fwnode_connector_add_link()
Date: Mon, 4 Mar 2024 07:23:19 +0000 [thread overview]
Message-ID: <ZeV25-dTLVE_vyqx@kekkonen.localdomain> (raw)
In-Reply-To: <9d0511cd-1fb2-4612-9b21-196a43ad0397@web.de>
Hi Markus,
On Fri, Mar 01, 2024 at 03:07:50PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 1 Mar 2024 15:02:09 +0100
>
> The kfree() function was called in one case by
> the v4l2_fwnode_connector_add_link() function during error handling
> even if the passed variable contained a null pointer.
> Thus use another label.
This isn't a problem, the code is fine as-is.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/media/v4l2-core/v4l2-fwnode.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
> index 89c7192148df..dc6daf3a9a51 100644
> --- a/drivers/media/v4l2-core/v4l2-fwnode.c
> +++ b/drivers/media/v4l2-core/v4l2-fwnode.c
> @@ -744,7 +744,7 @@ int v4l2_fwnode_connector_add_link(struct fwnode_handle *fwnode,
> link = kzalloc(sizeof(*link), GFP_KERNEL);
> if (!link) {
> err = -ENOMEM;
> - goto err;
> + goto put_fwnode_ep;
> }
>
> err = v4l2_fwnode_parse_link(connector_ep, &link->fwnode_link);
> @@ -760,6 +760,7 @@ int v4l2_fwnode_connector_add_link(struct fwnode_handle *fwnode,
>
> err:
> kfree(link);
> +put_fwnode_ep:
> fwnode_handle_put(connector_ep);
>
> return err;
> --
> 2.44.0
>
--
Sakari Ailus
prev parent reply other threads:[~2024-03-04 7:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 14:07 Markus Elfring
2024-03-04 7:23 ` Sakari Ailus [this message]
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=ZeV25-dTLVE_vyqx@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=Markus.Elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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
all inboxes | Powered by JetHome®