All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 2/4] driver: net: fsl-mc: Check NULL before pointer dereference
@ 2016-03-18 10:45 Prabhakar Kushwaha
  2016-03-25 21:16 ` Joe Hershberger
  0 siblings, 1 reply; 2+ messages in thread
From: Prabhakar Kushwaha @ 2016-03-18 10:45 UTC (permalink / raw)
  To: u-boot

NULL pointer should be checked before any dereference.  This patch
move memest after the NULL pointer check.

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reported-by: Jose Rivera <german.rivera@nxp.com>
---
 drivers/net/fsl-mc/dpio/qbman_sys.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/fsl-mc/dpio/qbman_sys.h b/drivers/net/fsl-mc/dpio/qbman_sys.h
index 235d641..7a537fb 100644
--- a/drivers/net/fsl-mc/dpio/qbman_sys.h
+++ b/drivers/net/fsl-mc/dpio/qbman_sys.h
@@ -255,11 +255,11 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 	s->addr_cena = d->cena_bar;
 	s->addr_cinh = d->cinh_bar;
 	s->cena = (void *)valloc(CONFIG_SYS_PAGE_SIZE);
-	memset((void *)s->cena, 0x00, CONFIG_SYS_PAGE_SIZE);
 	if (!s->cena) {
 		printf("Could not allocate page for cena shadow\n");
 		return -1;
 	}
+	memset((void *)s->cena, 0x00, CONFIG_SYS_PAGE_SIZE);
 
 #ifdef QBMAN_CHECKING
 	/* We should never be asked to initialise for a portal that isn't in
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH 2/4] driver: net: fsl-mc: Check NULL before pointer dereference
  2016-03-18 10:45 [U-Boot] [PATCH 2/4] driver: net: fsl-mc: Check NULL before pointer dereference Prabhakar Kushwaha
@ 2016-03-25 21:16 ` Joe Hershberger
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Hershberger @ 2016-03-25 21:16 UTC (permalink / raw)
  To: u-boot

On Fri, Mar 18, 2016 at 5:45 AM, Prabhakar Kushwaha
<prabhakar.kushwaha@nxp.com> wrote:
> NULL pointer should be checked before any dereference.  This patch
> move memest after the NULL pointer check.
>
> Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> Reported-by: Jose Rivera <german.rivera@nxp.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-25 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-18 10:45 [U-Boot] [PATCH 2/4] driver: net: fsl-mc: Check NULL before pointer dereference Prabhakar Kushwaha
2016-03-25 21:16 ` Joe Hershberger

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.