All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: lustre: include: lustre_update.h: Fix for possible null pointer dereference
@ 2015-01-29 18:47 Rickard Strandqvist
  2015-01-29 19:40 ` [HPDD-discuss] " Frank Zago
  0 siblings, 1 reply; 5+ messages in thread
From: Rickard Strandqvist @ 2015-01-29 18:47 UTC (permalink / raw)
  To: Oleg Drokin, Andreas Dilger
  Cc: Rickard Strandqvist, Greg Kroah-Hartman, HPDD-discuss, devel,
	linux-kernel

Fix a possible null pointer dereference, there is
otherwise a risk of a possible null pointer dereference.

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/staging/lustre/lustre/include/lustre_update.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_update.h b/drivers/staging/lustre/lustre/include/lustre_update.h
index 84defce..00e1361 100644
--- a/drivers/staging/lustre/lustre/include/lustre_update.h
+++ b/drivers/staging/lustre/lustre/include/lustre_update.h
@@ -165,12 +165,14 @@ static inline int update_get_reply_buf(struct update_reply *reply, void **buf,
 	int  result;
 
 	ptr = update_get_buf_internal(reply, index, &size);
+
+	LASSERT((ptr != NULL && size >= sizeof(int)));
+
 	result = *(int *)ptr;
 
 	if (result < 0)
 		return result;
 
-	LASSERT((ptr != NULL && size >= sizeof(int)));
 	*buf = ptr + sizeof(int);
 	return size - sizeof(int);
 }
-- 
1.7.10.4


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

end of thread, other threads:[~2015-01-29 20:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-29 18:47 [PATCH] staging: lustre: include: lustre_update.h: Fix for possible null pointer dereference Rickard Strandqvist
2015-01-29 19:40 ` [HPDD-discuss] " Frank Zago
2015-01-29 19:47   ` Rickard Strandqvist
2015-01-29 19:49     ` Frank Zago
2015-01-29 20:26       ` Drokin, Oleg

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.