From: Borislav Petkov <bp@alien8.de>
To: Tero Kristo <tero.kristo@linux.intel.com>
Cc: Ma Ke <make24@iscas.ac.cn>,
kristo@kernel.org, tony.luck@intel.com, james.morse@arm.com,
mchehab@kernel.org, rric@kernel.org, akpm@linux-foundation.org,
linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v5 RESEND] EDAC/ti: Fix possible null pointer dereference in _emif_get_id()
Date: Mon, 4 Nov 2024 16:40:43 +0100 [thread overview]
Message-ID: <20241104154043.GDZyjq-4Kt-IXTrf3y@fat_crate.local> (raw)
In-Reply-To: <20240824112643.2143250-1-make24@iscas.ac.cn>
Hi Tero,
ack/nak?
Is your MAINTAINERS entry for this driver still valid/current or should
I orphan it?
Thx.
On Sat, Aug 24, 2024 at 07:26:43PM +0800, Ma Ke wrote:
> In _emif_get_id(), of_get_address() may return NULL which is later
> dereferenced. Fix this bug by adding NULL check.
>
> Found by code review.
>
> Cc: stable@vger.kernel.org
> Fixes: 86a18ee21e5e ("EDAC, ti: Add support for TI keystone and DRA7xx EDAC")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202408160935.A6QFliqt-lkp@intel.com/
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
> ---
> Changes in v5:
> - According to the developer's suggestion, added an inspection of function
> of_translate_address(). However, kernel test robot reported a build
> warning, so the inspection is removed here, reverting to the modification
> solution of patch v3.
> Changes in v4:
> - added the check of of_translate_address() as suggestions.
> Changes in v3:
> - added the patch operations omitted in PATCH v2 RESEND compared to PATCH
> v2. Sorry for my oversight.
> Changes in v2:
> - added Cc stable line.
> ---
> drivers/edac/ti_edac.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/edac/ti_edac.c b/drivers/edac/ti_edac.c
> index 29723c9592f7..6f3da8d99eab 100644
> --- a/drivers/edac/ti_edac.c
> +++ b/drivers/edac/ti_edac.c
> @@ -207,6 +207,9 @@ static int _emif_get_id(struct device_node *node)
> int my_id = 0;
>
> addrp = of_get_address(node, 0, NULL, NULL);
> + if (!addrp)
> + return -EINVAL;
> +
> my_addr = (u32)of_translate_address(node, addrp);
>
> for_each_matching_node(np, ti_edac_of_match) {
> @@ -214,6 +217,9 @@ static int _emif_get_id(struct device_node *node)
> continue;
>
> addrp = of_get_address(np, 0, NULL, NULL);
> + if (!addrp)
> + return -EINVAL;
> +
> addr = (u32)of_translate_address(np, addrp);
>
> edac_printk(KERN_INFO, EDAC_MOD_NAME,
> --
> 2.25.1
>
>
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
prev parent reply other threads:[~2024-11-04 15:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-24 11:26 Ma Ke
2024-11-04 15:40 ` Borislav Petkov [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=20241104154043.GDZyjq-4Kt-IXTrf3y@fat_crate.local \
--to=bp@alien8.de \
--cc=akpm@linux-foundation.org \
--cc=james.morse@arm.com \
--cc=kristo@kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=make24@iscas.ac.cn \
--cc=mchehab@kernel.org \
--cc=rric@kernel.org \
--cc=tero.kristo@linux.intel.com \
--cc=tony.luck@intel.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
all inboxes | Powered by JetHome®