public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ib_types.h add debug assert
@ 2010-05-21 17:49 Smith, Stan
       [not found] ` <3F6F638B8D880340AB536D29CD4C1E192562EBBC01-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Smith, Stan @ 2010-05-21 17:49 UTC (permalink / raw)
  To: Sasha Khapyorsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org


Add a debug assert to catch incorrect MAD attr offset size.
This proved to be useful in catching incorrect struct sizes as MAD attrs need to be a multiple of 8 bytes.

signed-off-by: stan smith <stan.smith-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

diff --git a/opensm/include/iba/ib_types.h b/opensm/include/iba/ib_types.h
index e1bc102..203c319 100644
--- a/opensm/include/iba/ib_types.h
+++ b/opensm/include/iba/ib_types.h
@@ -4395,6 +4395,7 @@ static inline uint32_t OSM_API ib_get_attr_size(IN const ib_net16_t attr_offset)

 static inline ib_net16_t OSM_API ib_get_attr_offset(IN const uint32_t attr_size)
 {
+       CL_ASSERT((attr_size & 0x07) == 0);
        return (cl_hton16((uint16_t) (attr_size >> 3)));
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2010-05-25 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 17:49 [PATCH] ib_types.h add debug assert Smith, Stan
     [not found] ` <3F6F638B8D880340AB536D29CD4C1E192562EBBC01-osO9UTpF0USkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-05-25 11:24   ` Sasha Khapyorsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox