<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=408242209-25012009><FONT face=Arial color=#0000ff
size=2>Applied in 1880</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> ofw-bounces@lists.openfabrics.org
[mailto:ofw-bounces@lists.openfabrics.org] <B>On Behalf Of </B>Leonid
Keller<BR><B>Sent:</B> Sunday, January 18, 2009 6:23 PM<BR><B>To:</B>
ofw@lists.openfabrics.org<BR><B>Subject:</B> [ofw][patch][CORE] bugfix in
debug prints<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2><SPAN class=283101416-18012009>On x86 platform
casting expression like </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=283101416-18012009>
(LONG_PTR)p_obj </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=283101416-18012009>doesn't increase
the size of pointer.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=283101416-18012009>As a result
printf() function - driven by %I64 size modifier - takes the next
parameter as a second part of the previous one.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=283101416-18012009>It causes a
corrupted print at least and a crash at most.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=283101416-18012009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=283101416-18012009>The patch replaces
%I64Ix fixed-size format modifier by the variable-sized %p
one.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Index:
core/al/al_common.c<BR>===================================================================<BR>---
core/al/al_common.c (revision 1835)<BR>+++
core/al/al_common.c (working copy)<BR>@@ -180,7 +180,7
@@<BR> CL_ASSERT( p_obj && pfn_free
);<BR> CL_ASSERT( p_obj->state == CL_UNINITIALIZED
);<BR> AL_PRINT( TRACE_LEVEL_INFORMATION,
AL_DBG_AL_OBJ,<BR>- ("%016I64x\n", (LONG_PTR)p_obj )
);<BR>+ ("%p\n", p_obj ) );<BR> <BR> /* Initialize
the object. */<BR> p_obj->async_item.pfn_callback =
async_destroy_cb;<BR>@@ -278,9 +278,9 @@<BR> CL_ASSERT(
p_child_obj->state == CL_INITIALIZED );<BR> <BR> AL_PRINT(
TRACE_LEVEL_INFORMATION, AL_DBG_AL_OBJ,<BR>- ("%016I64x(%s) to
%016I64x(%s)\n",<BR>- (LONG_PTR)p_child_obj, ib_get_obj_type(
p_child_obj ),<BR>- (LONG_PTR)p_parent_obj, ib_get_obj_type(
p_parent_obj ) ) );<BR>+ ("%p(%s) to
%p(%s)\n",<BR>+ p_child_obj, ib_get_obj_type( p_child_obj
),<BR>+ p_parent_obj, ib_get_obj_type( p_parent_obj ) )
);<BR> <BR> /* Insert the object into the parent's object
tracking list. */<BR> p_child_obj->p_ci_ca =
p_parent_obj->p_ci_ca;<BR>@@ -347,9 +347,9
@@<BR> p_parent_obj->state == CL_DESTROYING
);<BR> <BR> AL_PRINT( TRACE_LEVEL_INFORMATION,
AL_DBG_AL_OBJ,<BR>- ("%016I64x(%s) from
%016I64x(%s)\n",<BR>- (LONG_PTR)p_obj, ib_get_obj_type( p_obj
),<BR>- (LONG_PTR)p_parent_obj, ib_get_obj_type( p_parent_obj ) )
);<BR>+ ("%p(%s) from %p(%s)\n",<BR>+ p_obj,
ib_get_obj_type( p_obj ),<BR>+ p_parent_obj, ib_get_obj_type(
p_parent_obj ) ) );<BR> <BR> /* Remove the object from the
parent's list. */<BR> cl_spinlock_acquire(
&p_parent_obj->lock );<BR>@@ -373,7 +373,7
@@<BR> <BR> AL_ENTER( AL_DBG_AL_OBJ
);<BR> AL_PRINT( TRACE_LEVEL_INFORMATION,
AL_DBG_AL_OBJ,<BR>- ("%016I64x(%s)\n", (LONG_PTR)p_obj,
ib_get_obj_type( p_obj ) ) );<BR>+ ("%p(%s)\n", p_obj,
ib_get_obj_type( p_obj ) ) );<BR> ref_cnt = cl_atomic_inc(
&p_obj->ref_cnt );<BR> CL_ASSERT( ref_cnt != 1 ||
p_obj->type == AL_OBJ_TYPE_H_CQ );<BR> <BR>@@ -401,7 +401,7
@@<BR> CL_ASSERT( p_obj->ref_cnt
);<BR> <BR> AL_PRINT( TRACE_LEVEL_INFORMATION,
AL_DBG_AL_OBJ,<BR>- ("%016I64x(%s)\n", (LONG_PTR)p_obj,
ib_get_obj_type( p_obj ) ) );<BR>+ ("%p(%s)\n", p_obj,
ib_get_obj_type( p_obj ) ) );<BR> <BR> ref_cnt =
cl_atomic_dec( &p_obj->ref_cnt );<BR> <BR>@@ -569,7 +569,7
@@<BR> p_obj->state == CL_DESTROYING
);<BR> <BR> AL_PRINT( TRACE_LEVEL_INFORMATION,
AL_DBG_AL_OBJ,<BR>- ("%016I64x(%s)\n", (LONG_PTR)p_obj,
ib_get_obj_type( p_obj ) ) );<BR>+ ("%p(%s)\n", p_obj,
ib_get_obj_type( p_obj ) ) );<BR> <BR> /*<BR> *
Lock to synchronize with asynchronous event processing.<BR>@@ -614,7 +614,7
@@<BR> p_child_obj = PARENT_STRUCT( p_list_item, al_obj_t,
pool_item );<BR> CL_ASSERT( p_child_obj->pfn_destroy
);<BR> AL_PRINT( TRACE_LEVEL_INFORMATION,
AL_DBG_AL_OBJ,<BR>- ("bye bye: %016I64x(%s)\n",
(LONG_PTR)p_child_obj,<BR>+ ("bye bye: %p(%s)\n",
p_child_obj,<BR> ib_get_obj_type( p_child_obj ) )
);<BR> ref_al_obj( p_child_obj
);<BR> p_child_obj->pfn_destroy( p_child_obj, NULL
);<BR>@@ -659,7 +659,7 @@<BR> CL_ASSERT( !p_obj->ref_cnt
);<BR> <BR> AL_PRINT( TRACE_LEVEL_INFORMATION,
AL_DBG_AL_OBJ,<BR>- ("%016I64x\n", (LONG_PTR)p_obj )
);<BR>+ ("%p\n", p_obj ) );<BR> <BR> /* Cleanup any
hardware related resources. */<BR> if( p_obj->pfn_cleanup
)<BR>Index:
core/al/al_common.h<BR>===================================================================<BR>---
core/al/al_common.h (revision 1835)<BR>+++
core/al/al_common.h (working copy)<BR>@@ -326,7 +326,7
@@<BR> ib_get_obj_type(<BR> IN al_obj_t
* const p_obj )<BR> {<BR>- if( AL_BASE_TYPE(
p_obj->type ) > AL_OBJ_TYPE_INVALID )<BR>+ if( AL_BASE_TYPE(
p_obj->type ) >= AL_OBJ_TYPE_INVALID )<BR> return(
ib_obj_type_str[AL_OBJ_TYPE_UNKNOWN] );<BR> <BR> return(
ib_obj_type_str[ AL_BASE_TYPE( p_obj->type ) ] );<BR>Index:
core/al/al_mad.c<BR>===================================================================<BR>---
core/al/al_mad.c (revision 1835)<BR>+++ core/al/al_mad.c (working
copy)<BR>@@ -680,13 +680,13 @@<BR> cl_ptr_vector_set(
p_method_ptr_vector, i, h_mad_reg
);<BR> <BR> AL_PRINT( TRACE_LEVEL_INFORMATION,
AL_DBG_MAD_SVC,<BR>- ("Register version:%u (%u)
class:0x%02X(%u) method:0x%02X
Hdl:%016I64x\n",<BR>+ ("Register version:%u (%u)
class:0x%02X(%u) method:0x%02X
Hdl:%p\n",<BR> p_mad_svc->mgmt_version,<BR> __mgmt_version_index(
p_mad_svc->mgmt_version
),<BR> p_mad_svc->mgmt_class,<BR> __mgmt_class_index(
p_mad_svc->mgmt_class
),<BR> i,<BR>- (LONG_PTR)h_mad_reg)
);<BR>+ h_mad_reg)
);<BR> }<BR> }<BR> <BR>@@ -841,7 +841,7
@@<BR> AL_ENTER( AL_DBG_MAD_SVC
);<BR> <BR> AL_PRINT( TRACE_LEVEL_INFORMATION,
AL_DBG_MAD_SVC,<BR>- ("p_mad_wr 0x%016I64x\n", (LONG_PTR)p_mad_wr )
);<BR>+ ("p_mad_wr 0x%p\n", p_mad_wr )
);<BR> <BR> /* Get the MAD header. */<BR> p_mad_hdr
= get_mad_hdr_from_wr( p_mad_wr );<BR>Index:
core/al/kernel/al_dev.c<BR>===================================================================<BR>---
core/al/kernel/al_dev.c (revision 1835)<BR>+++
core/al/kernel/al_dev.c (working copy)<BR>@@ -443,8 +443,8
@@<BR> p_open_context =
p_io_stack->FileObject->FsContext;<BR> <BR> AL_PRINT(
TRACE_LEVEL_INFORMATION, AL_DBG_DEV,<BR>- ("al_dev_ioctl: buf_size
(%d) p_buf (%016I64x).\n",<BR>- cl_ioctl_in_size( h_ioctl ),
(LONG_PTR)cl_ioctl_in_buf( h_ioctl )) );<BR>+ ("al_dev_ioctl:
buf_size (%d) p_buf (%p).\n",<BR>+ cl_ioctl_in_size( h_ioctl ),
cl_ioctl_in_buf( h_ioctl )) );<BR> <BR> /* Process the ioctl
command. */<BR> if( IS_AL_PROXY_IOCTL(cl_ioctl_ctl_code( h_ioctl ))
)<BR>Index:
core/al/kernel/al_mad_pool.c<BR>===================================================================<BR>---
core/al/kernel/al_mad_pool.c (revision 1835)<BR>+++
core/al/kernel/al_mad_pool.c (working copy)<BR>@@ -271,7 +271,7
@@<BR> if( busy )<BR> {<BR> AL_PRINT(
TRACE_LEVEL_ERROR, AL_DBG_ERROR,<BR>- ("h_pool (0x%016I64x)
is busy!.\n", (ULONG64)(ULONG_PTR)h_pool) );<BR>+ ("h_pool
(0x%p) is busy!.\n", h_pool) );<BR> return
IB_RESOURCE_BUSY;<BR> }<BR> <BR>Index:
core/al/kernel/al_proxy.c<BR>===================================================================<BR>---
core/al/kernel/al_proxy.c (revision 1835)<BR>+++
core/al/kernel/al_proxy.c (working copy)<BR>@@ -301,8 +301,8
@@<BR> if( (uintn_t)p_io_stack->FileObject->FsContext2 !=
AL_OBJ_TYPE_H_CQ )<BR> {<BR> AL_PRINT_EXIT(
TRACE_LEVEL_ERROR, AL_DBG_ERROR,<BR>- ("Invalid file object
type for request:
%016I64x\n",<BR>- (LONG_PTR)p_io_stack->FileObject->FsContext2)
);<BR>+ ("Invalid file object type for request:
%p\n",<BR>+ p_io_stack->FileObject->FsContext2)
);<BR> return
CL_INVALID_PARAMETER;<BR> }<BR> <BR>@@ -343,8 +343,8
@@<BR> if( (uintn_t)p_io_stack->FileObject->FsContext2 !=
AL_OBJ_TYPE_AL_MGR )<BR> {<BR> AL_PRINT_EXIT(
TRACE_LEVEL_ERROR, AL_DBG_ERROR,<BR>- ("Invalid file object
type for request:
%016I64x\n",<BR>- (LONG_PTR)p_io_stack->FileObject->FsContext2)
);<BR>+ ("Invalid file object type for request:
%p\n",<BR>+ p_io_stack->FileObject->FsContext2)
);<BR> return
CL_INVALID_PARAMETER;<BR> }<BR> <BR>@@ -891,8 +891,8
@@<BR> if( (uintn_t)p_io_stack->FileObject->FsContext2 !=
AL_OBJ_TYPE_PNP_MGR )<BR> {<BR> AL_PRINT_EXIT(
TRACE_LEVEL_ERROR, AL_DBG_ERROR,<BR>- ("Invalid file object
type for request:
%016I64x\n",<BR>- (LONG_PTR)p_io_stack->FileObject->FsContext2)
);<BR>+ ("Invalid file object type for request:
%p\n",<BR>+ p_io_stack->FileObject->FsContext2)
);<BR> return
CL_INVALID_PARAMETER;<BR> }<BR> <BR>@@ -1035,8 +1035,8
@@<BR> if( (uintn_t)p_io_stack->FileObject->FsContext2 !=
AL_OBJ_TYPE_PNP_MGR )<BR> {<BR> AL_PRINT_EXIT(
TRACE_LEVEL_ERROR, AL_DBG_ERROR,<BR>- ("Invalid file object
type for request:
%016I64x\n",<BR>- (LONG_PTR)p_io_stack->FileObject->FsContext2)
);<BR>+ ("Invalid file object type for request:
%p\n",<BR>+ p_io_stack->FileObject->FsContext2)
);<BR> return
CL_INVALID_PARAMETER;<BR> }<BR> <BR>@@ -1117,8 +1117,8
@@<BR> if( (uintn_t)p_io_stack->FileObject->FsContext2 !=
AL_OBJ_TYPE_PNP_MGR )<BR> {<BR> AL_PRINT_EXIT(
TRACE_LEVEL_ERROR, AL_DBG_ERROR,<BR>- ("Invalid file object
type for request:
%016I64x\n",<BR>- (LONG_PTR)p_io_stack->FileObject->FsContext2)
);<BR>+ ("Invalid file object type for request:
%p\n",<BR>+ p_io_stack->FileObject->FsContext2)
);<BR> return
CL_INVALID_PARAMETER;<BR> }<BR> <BR>Index:
core/al/kernel/al_proxy_cep.c<BR>===================================================================<BR>---
core/al/kernel/al_proxy_cep.c (revision 1835)<BR>+++
core/al/kernel/al_proxy_cep.c (working copy)<BR>@@ -835,8 +835,8
@@<BR> if( (uintn_t)p_io_stack->FileObject->FsContext2 !=
AL_OBJ_TYPE_CM )<BR> {<BR> AL_PRINT_EXIT(
TRACE_LEVEL_ERROR, AL_DBG_ERROR,<BR>- ("Invalid file object
type for request:
%016I64x\n",<BR>- (LONG_PTR)p_io_stack->FileObject->FsContext2)
);<BR>+ ("Invalid file object type for request:
%p\n",<BR>+ p_io_stack->FileObject->FsContext2)
);<BR> return
CL_INVALID_PARAMETER;<BR> }<BR> <BR>Index:
core/al/kernel/al_proxy_subnet.c<BR>===================================================================<BR>---
core/al/kernel/al_proxy_subnet.c (revision 1835)<BR>+++
core/al/kernel/al_proxy_subnet.c (working copy)<BR>@@ -230,8 +230,8
@@<BR> (uintn_t)p_io_stack->FileObject->FsContext2 !=
AL_OBJ_TYPE_SA_REQ_SVC )<BR> {<BR> AL_PRINT_EXIT(
TRACE_LEVEL_ERROR, AL_DBG_ERROR,<BR>- ("Invalid file object
type for request:
%016I64x\n",<BR>- (LONG_PTR)p_io_stack->FileObject->FsContext2)
);<BR>+ ("Invalid file object type for request:
%p\n",<BR>+ p_io_stack->FileObject->FsContext2)
);<BR> return
CL_INVALID_PARAMETER;<BR> }<BR> <BR>Index:
core/al/kernel/al_smi.c<BR>===================================================================<BR>---
core/al/kernel/al_smi.c (revision 1835)<BR>+++
core/al/kernel/al_smi.c (working copy)<BR>@@ -3430,8 +3430,8
@@<BR> if( status != IB_SUCCESS
)<BR> {<BR> AL_PRINT(
TRACE_LEVEL_ERROR, AL_DBG_ERROR,<BR>- ("Failed to post
receive %016I64x\n",<BR>- (LONG_PTR)p_al_element)
);<BR>+ ("Failed to post receive
%p\n",<BR>+ p_al_element)
);<BR> cl_qlist_remove_item(
&p_spl_qp_svc->recv_queue,<BR> &p_al_element->list_item
);<BR> <BR></FONT></DIV></BLOCKQUOTE></BODY></HTML>