[Cbe-oss-dev] [PATCH 1/2] libspe2: Add error checks on invalid callback handler

Kazunori Asayama asayama at sm.sony.co.jp
Thu Apr 24 18:57:22 EST 2008


This patch adds error checks on invalid callback handler to the
spe_callback_handler_register function.

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
---
 spebase/lib_builtin.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: b/spebase/lib_builtin.c
===================================================================
--- a/spebase/lib_builtin.c	2007-08-27 19:28:14.000000000 +0900
+++ b/spebase/lib_builtin.c	2008-04-22 16:04:52.000000000 +0900
@@ -56,6 +56,10 @@ int _base_spe_callback_handler_register(
 			errno = EACCES;
 			return -1;
 		}
+		if (handler == NULL) {
+			errno = EINVAL;
+			return -1;
+		}
 		handlers[callnum] = handler;
 		break;
 
@@ -64,6 +68,10 @@ int _base_spe_callback_handler_register(
 			errno = ESRCH;
 			return -1;
 		}
+		if (handler == NULL) {
+			errno = EINVAL;
+			return -1;
+		}
 		handlers[callnum] = handler;
 		break;
 	default:




More information about the cbe-oss-dev mailing list