linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Johannes Thumshirn <morbidrsa@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tony Luck <tony.luck@intel.com>,
	James Morse <james.morse@arm.com>,
	Robert Richter <rric@kernel.org>,
	Doug Thompson <dougthompson@xmission.com>,
	Dave Jiang <djiang@mvista.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-edac <linux-edac@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] EDAC, mpc85xx: Fix error return code in two functions
Date: Mon, 31 May 2021 10:40:31 +0200	[thread overview]
Message-ID: <YLSg/8REPQoX8HL7@zn.tnic> (raw)
In-Reply-To: <20210528032637.9231-1-thunder.leizhen@huawei.com>

On Fri, May 28, 2021 at 11:26:37AM +0800, Zhen Lei wrote:
> Fix to return -EFAULT from the error handling case instead of 0, as done
> elsewhere in its function.
> 
> Fixes: a9a753d53204 ("drivers-edac: add freescale mpc85xx driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  drivers/edac/mpc85xx_edac.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
> index 67f7bc3fe5b3..b2eaa62c9412 100644
> --- a/drivers/edac/mpc85xx_edac.c
> +++ b/drivers/edac/mpc85xx_edac.c
> @@ -248,6 +248,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
>  
>  	if (edac_pci_add_device(pci, pdata->edac_idx) > 0) {
>  		edac_dbg(3, "failed edac_pci_add_device()\n");
> +		res = -EFAULT;

>  		goto err;
>  	}
>  
> @@ -552,6 +553,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
>  
>  	if (edac_device_add_device(edac_dev) > 0) {
>  		edac_dbg(3, "failed edac_device_add_device()\n");
> +		res = -EFAULT;
>  		goto err;
>  	}
>  
> -- 

EFAULT means

#define EFAULT          14      /* Bad address */

Does it make sense to you when the probe function returns a "bad
address" upon failure to add a device?

hint 1: you might wanna audit how the other drivers are calling this for
better ideas.

hint 2: while doing hint 1, you might find some more broken cases which
you could fix too.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2021-05-31  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28  3:26 Zhen Lei
2021-05-31  8:40 ` Borislav Petkov [this message]
2021-05-31  9:15   ` Leizhen (ThunderTown)
2021-05-31  9:23     ` Borislav Petkov

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=YLSg/8REPQoX8HL7@zn.tnic \
    --to=bp@alien8.de \
    --cc=akpm@linux-foundation.org \
    --cc=djiang@mvista.com \
    --cc=dougthompson@xmission.com \
    --cc=james.morse@arm.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=morbidrsa@gmail.com \
    --cc=rric@kernel.org \
    --cc=thunder.leizhen@huawei.com \
    --cc=tony.luck@intel.com \
    --subject='Re: [PATCH 1/1] EDAC, mpc85xx: Fix error return code in two functions' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).