[CORE] bugfix in debug prints. [mlnx: 3573]
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 25 Jan 2009 09:22:12 +0000 (09:22 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 25 Jan 2009 09:22:12 +0000 (09:22 +0000)
On x86 platform casting expression like
    (LONG_PTR)p_obj
doesn't increase the size of pointer.
As a result printf() function - driven by %I64 size modifier - takes the next parameter as a second part of the previous one.
It causes a corrupted print at least and a crash at most.

The patch replaces %I64Ix fixed-size format modifier by the  variable-sized %p one.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1880 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/al_common.c
core/al/al_common.h
core/al/al_mad.c
core/al/kernel/al_dev.c
core/al/kernel/al_mad_pool.c
core/al/kernel/al_proxy.c
core/al/kernel/al_proxy_cep.c
core/al/kernel/al_proxy_subnet.c
core/al/kernel/al_smi.c

index 0a82c36..4875d91 100644 (file)
@@ -180,7 +180,7 @@ init_al_obj(
        CL_ASSERT( p_obj && pfn_free );\r
        CL_ASSERT( p_obj->state == CL_UNINITIALIZED );\r
        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_AL_OBJ,\r
-               ("%016I64x\n", (LONG_PTR)p_obj ) );\r
+               ("%p\n", p_obj ) );\r
 \r
        /* Initialize the object. */\r
        p_obj->async_item.pfn_callback = async_destroy_cb;\r
@@ -278,9 +278,9 @@ attach_al_obj(
        CL_ASSERT( p_child_obj->state == CL_INITIALIZED );\r
 \r
        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_AL_OBJ,\r
-               ("%016I64x(%s) to %016I64x(%s)\n",\r
-               (LONG_PTR)p_child_obj, ib_get_obj_type( p_child_obj ),\r
-               (LONG_PTR)p_parent_obj, ib_get_obj_type( p_parent_obj ) ) );\r
+               ("%p(%s) to %p(%s)\n",\r
+               p_child_obj, ib_get_obj_type( p_child_obj ),\r
+               p_parent_obj, ib_get_obj_type( p_parent_obj ) ) );\r
 \r
        /* Insert the object into the parent's object tracking list. */\r
        p_child_obj->p_ci_ca = p_parent_obj->p_ci_ca;\r
@@ -347,9 +347,9 @@ detach_al_obj(
                p_parent_obj->state == CL_DESTROYING );\r
 \r
        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_AL_OBJ,\r
-               ("%016I64x(%s) from %016I64x(%s)\n",\r
-               (LONG_PTR)p_obj, ib_get_obj_type( p_obj ),\r
-               (LONG_PTR)p_parent_obj, ib_get_obj_type( p_parent_obj ) ) );\r
+               ("%p(%s) from %p(%s)\n",\r
+               p_obj, ib_get_obj_type( p_obj ),\r
+               p_parent_obj, ib_get_obj_type( p_parent_obj ) ) );\r
 \r
        /* Remove the object from the parent's list. */\r
        cl_spinlock_acquire( &p_parent_obj->lock );\r
@@ -373,7 +373,7 @@ ref_al_obj(
 \r
        AL_ENTER( AL_DBG_AL_OBJ );\r
        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_AL_OBJ,\r
-               ("%016I64x(%s)\n", (LONG_PTR)p_obj, ib_get_obj_type( p_obj ) ) );\r
+               ("%p(%s)\n", p_obj, ib_get_obj_type( p_obj ) ) );\r
        ref_cnt = cl_atomic_inc( &p_obj->ref_cnt );\r
        CL_ASSERT( ref_cnt != 1 || p_obj->type == AL_OBJ_TYPE_H_CQ );\r
 \r
@@ -401,7 +401,7 @@ deref_al_obj(
        CL_ASSERT( p_obj->ref_cnt );\r
 \r
        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_AL_OBJ,\r
-               ("%016I64x(%s)\n", (LONG_PTR)p_obj, ib_get_obj_type( p_obj ) ) );\r
+               ("%p(%s)\n", p_obj, ib_get_obj_type( p_obj ) ) );\r
 \r
        ref_cnt = cl_atomic_dec( &p_obj->ref_cnt );\r
 \r
@@ -569,7 +569,7 @@ destroy_obj(
                p_obj->state == CL_DESTROYING );\r
 \r
        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_AL_OBJ,\r
-               ("%016I64x(%s)\n", (LONG_PTR)p_obj, ib_get_obj_type( p_obj ) ) );\r
+               ("%p(%s)\n", p_obj, ib_get_obj_type( p_obj ) ) );\r
 \r
        /*\r
         * Lock to synchronize with asynchronous event processing.\r
@@ -614,7 +614,7 @@ destroy_obj(
                p_child_obj = PARENT_STRUCT( p_list_item, al_obj_t, pool_item );\r
                CL_ASSERT( p_child_obj->pfn_destroy );\r
                AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_AL_OBJ,\r
-                       ("bye bye: %016I64x(%s)\n", (LONG_PTR)p_child_obj,\r
+                       ("bye bye: %p(%s)\n", p_child_obj,\r
                        ib_get_obj_type( p_child_obj ) ) );\r
                ref_al_obj( p_child_obj );\r
                p_child_obj->pfn_destroy( p_child_obj, NULL );\r
@@ -659,7 +659,7 @@ async_destroy_cb(
        CL_ASSERT( !p_obj->ref_cnt );\r
 \r
        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_AL_OBJ,\r
-               ("%016I64x\n", (LONG_PTR)p_obj ) );\r
+               ("%p\n", p_obj ) );\r
 \r
        /* Cleanup any hardware related resources. */\r
        if( p_obj->pfn_cleanup )\r
index 65ff058..1428869 100644 (file)
@@ -326,7 +326,7 @@ static inline const char*
 ib_get_obj_type(\r
        IN                              al_obj_t * const                        p_obj )\r
 {\r
-       if( AL_BASE_TYPE( p_obj->type ) > AL_OBJ_TYPE_INVALID )\r
+       if( AL_BASE_TYPE( p_obj->type ) >= AL_OBJ_TYPE_INVALID )\r
                return( ib_obj_type_str[AL_OBJ_TYPE_UNKNOWN] );\r
 \r
        return( ib_obj_type_str[ AL_BASE_TYPE( p_obj->type ) ] );\r
index 389305b..f60e8fb 100644 (file)
@@ -680,13 +680,13 @@ __mad_disp_reg_unsol(
                        cl_ptr_vector_set( p_method_ptr_vector, i, h_mad_reg );\r
 \r
                        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_MAD_SVC,\r
-                               ("Register version:%u (%u) class:0x%02X(%u) method:0x%02X Hdl:%016I64x\n",\r
+                               ("Register version:%u (%u) class:0x%02X(%u) method:0x%02X Hdl:%p\n",\r
                                p_mad_svc->mgmt_version,\r
                                __mgmt_version_index( p_mad_svc->mgmt_version ),\r
                                p_mad_svc->mgmt_class,\r
                                __mgmt_class_index( p_mad_svc->mgmt_class ),\r
                                i,\r
-                               (LONG_PTR)h_mad_reg) );\r
+                               h_mad_reg) );\r
                }\r
        }\r
 \r
@@ -841,7 +841,7 @@ mad_disp_send_done(
        AL_ENTER( AL_DBG_MAD_SVC );\r
 \r
        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_MAD_SVC,\r
-               ("p_mad_wr 0x%016I64x\n", (LONG_PTR)p_mad_wr ) );\r
+               ("p_mad_wr 0x%p\n", p_mad_wr ) );\r
 \r
        /* Get the MAD header. */\r
        p_mad_hdr = get_mad_hdr_from_wr( p_mad_wr );\r
index c5840f3..a028370 100644 (file)
@@ -443,8 +443,8 @@ al_dev_ioctl(
        p_open_context = p_io_stack->FileObject->FsContext;\r
 \r
        AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_DEV,\r
-               ("al_dev_ioctl: buf_size (%d) p_buf (%016I64x).\n",\r
-               cl_ioctl_in_size( h_ioctl ), (LONG_PTR)cl_ioctl_in_buf( h_ioctl )) );\r
+               ("al_dev_ioctl: buf_size (%d) p_buf (%p).\n",\r
+               cl_ioctl_in_size( h_ioctl ), cl_ioctl_in_buf( h_ioctl )) );\r
 \r
        /* Process the ioctl command. */\r
        if( IS_AL_PROXY_IOCTL(cl_ioctl_ctl_code( h_ioctl )) )\r
index 1074296..e4535d3 100644 (file)
@@ -271,7 +271,7 @@ ib_destroy_mad_pool(
        if( busy )\r
        {\r
                AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-                       ("h_pool (0x%016I64x) is busy!.\n", (ULONG64)(ULONG_PTR)h_pool) );\r
+                       ("h_pool (0x%p) is busy!.\n", h_pool) );\r
                return IB_RESOURCE_BUSY;\r
        }\r
 \r
index 550f42f..e89d363 100644 (file)
@@ -301,8 +301,8 @@ proxy_get_comp_cb(
        if( (uintn_t)p_io_stack->FileObject->FsContext2 != AL_OBJ_TYPE_H_CQ )\r
        {\r
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-                       ("Invalid file object type for request: %016I64x\n",\r
-                       (LONG_PTR)p_io_stack->FileObject->FsContext2) );\r
+                       ("Invalid file object type for request: %p\n",\r
+                       p_io_stack->FileObject->FsContext2) );\r
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
@@ -343,8 +343,8 @@ proxy_get_misc_cb(
        if( (uintn_t)p_io_stack->FileObject->FsContext2 != AL_OBJ_TYPE_AL_MGR )\r
        {\r
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-                       ("Invalid file object type for request: %016I64x\n",\r
-                       (LONG_PTR)p_io_stack->FileObject->FsContext2) );\r
+                       ("Invalid file object type for request: %p\n",\r
+                       p_io_stack->FileObject->FsContext2) );\r
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
@@ -891,8 +891,8 @@ proxy_reg_pnp(
        if( (uintn_t)p_io_stack->FileObject->FsContext2 != AL_OBJ_TYPE_PNP_MGR )\r
        {\r
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-                       ("Invalid file object type for request: %016I64x\n",\r
-                       (LONG_PTR)p_io_stack->FileObject->FsContext2) );\r
+                       ("Invalid file object type for request: %p\n",\r
+                       p_io_stack->FileObject->FsContext2) );\r
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
@@ -1035,8 +1035,8 @@ proxy_rearm_pnp(
        if( (uintn_t)p_io_stack->FileObject->FsContext2 != AL_OBJ_TYPE_PNP_MGR )\r
        {\r
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-                       ("Invalid file object type for request: %016I64x\n",\r
-                       (LONG_PTR)p_io_stack->FileObject->FsContext2) );\r
+                       ("Invalid file object type for request: %p\n",\r
+                       p_io_stack->FileObject->FsContext2) );\r
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
@@ -1117,8 +1117,8 @@ proxy_dereg_pnp(
        if( (uintn_t)p_io_stack->FileObject->FsContext2 != AL_OBJ_TYPE_PNP_MGR )\r
        {\r
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-                       ("Invalid file object type for request: %016I64x\n",\r
-                       (LONG_PTR)p_io_stack->FileObject->FsContext2) );\r
+                       ("Invalid file object type for request: %p\n",\r
+                       p_io_stack->FileObject->FsContext2) );\r
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
index 2ff44f0..2b174ee 100644 (file)
@@ -835,8 +835,8 @@ proxy_cep_get_event(
        if( (uintn_t)p_io_stack->FileObject->FsContext2 != AL_OBJ_TYPE_CM )\r
        {\r
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-                       ("Invalid file object type for request: %016I64x\n",\r
-                       (LONG_PTR)p_io_stack->FileObject->FsContext2) );\r
+                       ("Invalid file object type for request: %p\n",\r
+                       p_io_stack->FileObject->FsContext2) );\r
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
index 8e5b74e..07ec17a 100644 (file)
@@ -230,8 +230,8 @@ proxy_send_sa_req(
                (uintn_t)p_io_stack->FileObject->FsContext2 != AL_OBJ_TYPE_SA_REQ_SVC )\r
        {\r
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-                       ("Invalid file object type for request: %016I64x\n",\r
-                       (LONG_PTR)p_io_stack->FileObject->FsContext2) );\r
+                       ("Invalid file object type for request: %p\n",\r
+                       p_io_stack->FileObject->FsContext2) );\r
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
index 255c0c2..012f96b 100644 (file)
@@ -3430,8 +3430,8 @@ spl_qp_svc_post_recvs(
                if( status != IB_SUCCESS )\r
                {\r
                        AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
-                               ("Failed to post receive %016I64x\n",\r
-                               (LONG_PTR)p_al_element) );\r
+                               ("Failed to post receive %p\n",\r
+                               p_al_element) );\r
                        cl_qlist_remove_item( &p_spl_qp_svc->recv_queue,\r
                                &p_al_element->list_item );\r
 \r