mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 10:59:30 +08:00
sapi: Add param check to rtems_extension_create()
Check that the extensions table is not NULL. Change format. Update #3953.
This commit is contained in:
@@ -32,15 +32,21 @@ rtems_status_code rtems_extension_create(
|
||||
{
|
||||
Extension_Control *the_extension;
|
||||
|
||||
if ( !id )
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
|
||||
if ( !rtems_is_name_valid( name ) )
|
||||
if ( !rtems_is_name_valid( name ) ) {
|
||||
return RTEMS_INVALID_NAME;
|
||||
}
|
||||
|
||||
if ( extension_table == NULL ) {
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
if ( id == NULL ) {
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
the_extension = _Extension_Allocate();
|
||||
|
||||
if ( !the_extension ) {
|
||||
if ( the_extension == NULL ) {
|
||||
_Objects_Allocator_unlock();
|
||||
return RTEMS_TOO_MANY;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,11 @@ rtems_task Init(
|
||||
Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', '1' );
|
||||
Extension_name[ 2 ] = rtems_build_name( 'E', 'X', 'T', '2' );
|
||||
|
||||
puts ( "rtems_extension_create - bad table -- RTEMS_INVALID_ADDRESS" );
|
||||
status = rtems_extension_create( 0xa5a5a5a5, NULL, &id );
|
||||
fatal_directive_status(
|
||||
status, RTEMS_INVALID_ADDRESS, "rtems_extension_create" );
|
||||
|
||||
puts ( "rtems_extension_create - bad id pointer -- RTEMS_INVALID_ADDRESS" );
|
||||
status = rtems_extension_create( 0xa5a5a5a5, &Extensions, NULL );
|
||||
fatal_directive_status(
|
||||
|
||||
Reference in New Issue
Block a user