* [PATCH] fpga: zynqmp-fpga: Correctly handle error pointer
@ 2019-05-07 17:02 Moritz Fischer
2019-05-07 19:11 ` Alan Tull
0 siblings, 1 reply; 3+ messages in thread
From: Moritz Fischer @ 2019-05-07 17:02 UTC (permalink / raw)
To: linux-fpga
Cc: atull, linux-kernel, michal.simek, linux-arm-kernel,
Moritz Fischer, Dan Carpenter
Fixes the following static checker error:
drivers/fpga/zynqmp-fpga.c:50 zynqmp_fpga_ops_write()
error: 'eemi_ops' dereferencing possible ERR_PTR()
Note: This does not handle the EPROBE_DEFER value in a
special manner.
Fixes commit c09f7471127e ("fpga manager: Adding FPGA Manager support for
Xilinx zynqmp")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
drivers/fpga/zynqmp-fpga.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c
index f7cbaadf49ab..abcb0b2e75bf 100644
--- a/drivers/fpga/zynqmp-fpga.c
+++ b/drivers/fpga/zynqmp-fpga.c
@@ -47,7 +47,7 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,
char *kbuf;
int ret;
- if (!eemi_ops || !eemi_ops->fpga_load)
+ if (IS_ERR_OR_NULL(eemi_ops) || !eemi_ops->fpga_load)
return -ENXIO;
priv = mgr->priv;
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fpga: zynqmp-fpga: Correctly handle error pointer
2019-05-07 17:02 [PATCH] fpga: zynqmp-fpga: Correctly handle error pointer Moritz Fischer
@ 2019-05-07 19:11 ` Alan Tull
2019-05-07 19:31 ` Moritz Fischer
0 siblings, 1 reply; 3+ messages in thread
From: Alan Tull @ 2019-05-07 19:11 UTC (permalink / raw)
To: Moritz Fischer
Cc: linux-fpga, linux-kernel, Michal Simek,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
Dan Carpenter
On Tue, May 7, 2019 at 12:03 PM Moritz Fischer <mdf@kernel.org> wrote:
Hi Moritz,
>
> Fixes the following static checker error:
>
> drivers/fpga/zynqmp-fpga.c:50 zynqmp_fpga_ops_write()
> error: 'eemi_ops' dereferencing possible ERR_PTR()
>
> Note: This does not handle the EPROBE_DEFER value in a
> special manner.
>
> Fixes commit c09f7471127e ("fpga manager: Adding FPGA Manager support for
> Xilinx zynqmp")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
> ---
> drivers/fpga/zynqmp-fpga.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c
> index f7cbaadf49ab..abcb0b2e75bf 100644
> --- a/drivers/fpga/zynqmp-fpga.c
> +++ b/drivers/fpga/zynqmp-fpga.c
> @@ -47,7 +47,7 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,
> char *kbuf;
> int ret;
>
> - if (!eemi_ops || !eemi_ops->fpga_load)
> + if (IS_ERR_OR_NULL(eemi_ops) || !eemi_ops->fpga_load)
This if statement also happens in fpga_mgr_states
zynqmp_fpga_ops_state(), so we'll need this fix there also.
> return -ENXIO;
>
> priv = mgr->priv;
> --
> 2.21.0
>
Alan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fpga: zynqmp-fpga: Correctly handle error pointer
2019-05-07 19:11 ` Alan Tull
@ 2019-05-07 19:31 ` Moritz Fischer
0 siblings, 0 replies; 3+ messages in thread
From: Moritz Fischer @ 2019-05-07 19:31 UTC (permalink / raw)
To: Alan Tull
Cc: Moritz Fischer, linux-fpga, linux-kernel, Michal Simek,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
Dan Carpenter
Alan,
On Tue, May 07, 2019 at 02:11:06PM -0500, Alan Tull wrote:
> On Tue, May 7, 2019 at 12:03 PM Moritz Fischer <mdf@kernel.org> wrote:
>
> Hi Moritz,
>
> >
> > Fixes the following static checker error:
> >
> > drivers/fpga/zynqmp-fpga.c:50 zynqmp_fpga_ops_write()
> > error: 'eemi_ops' dereferencing possible ERR_PTR()
> >
> > Note: This does not handle the EPROBE_DEFER value in a
> > special manner.
> >
> > Fixes commit c09f7471127e ("fpga manager: Adding FPGA Manager support for
> > Xilinx zynqmp")
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Moritz Fischer <mdf@kernel.org>
> > ---
> > drivers/fpga/zynqmp-fpga.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c
> > index f7cbaadf49ab..abcb0b2e75bf 100644
> > --- a/drivers/fpga/zynqmp-fpga.c
> > +++ b/drivers/fpga/zynqmp-fpga.c
> > @@ -47,7 +47,7 @@ static int zynqmp_fpga_ops_write(struct fpga_manager *mgr,
> > char *kbuf;
> > int ret;
> >
> > - if (!eemi_ops || !eemi_ops->fpga_load)
> > + if (IS_ERR_OR_NULL(eemi_ops) || !eemi_ops->fpga_load)
>
> This if statement also happens in fpga_mgr_states
> zynqmp_fpga_ops_state(), so we'll need this fix there also.
Good catch, will fix in v2.
Thanks
Moritz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-07 19:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07 17:02 [PATCH] fpga: zynqmp-fpga: Correctly handle error pointer Moritz Fischer
2019-05-07 19:11 ` Alan Tull
2019-05-07 19:31 ` Moritz Fischer
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).