[openib-general] [Bug 92] New: sizeof(srp_indirect_buf) wrong on 64-bit platforms

bugzilla-daemon at openib.org bugzilla-daemon at openib.org
Mon May 22 13:11:05 PDT 2006


http://openib.org/bugzilla/show_bug.cgi?id=92

           Summary: sizeof(srp_indirect_buf) wrong on 64-bit platforms
           Product: OpenFabrics Linux
           Version: 1.0rc2
          Platform: IA64
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SRP
        AssignedTo: bugzilla at openib.org
        ReportedBy: chas at cmf.nrl.navy.mil


the packed attribute should be applied to the entire struct instead
of the just the array of srp_direct elements.  the size of this struct
should be 20, not 24 as the following test program indicates.

nothing critical depends on the sizeof of srp_indirect_buf but it
would be nice to be consistent. 

#include <stdio.h>

#define u64 unsigned long long
#define __be64 unsigned long long
#define __be32 unsigned int

struct srp_direct_buf {
        __be64  va;
        __be32  key;
        __be32  len;
};

struct srp_indirect_buf {
        struct srp_direct_buf   table_desc;
        __be32                  len;
        struct srp_direct_buf   desc_list[0] __attribute__((packed));
};

struct srp_indirect_buf2 {
        struct srp_direct_buf   table_desc;
        __be32                  len;
        struct srp_direct_buf   desc_list[0];
}  __attribute__((packed));

main()
{
        printf("sizeof(struct srp_direct_buf) = %d\n", sizeof(struct
srp_direct_buf));
        printf("sizeof(struct srp_indirect_buf) = %d\n", sizeof(struct
srp_indirect_buf));
        printf("sizeof(struct srp_indirect_buf2) = %d\n", sizeof(struct
srp_indirect_buf2));
}

--- drivers/infiniband/include/scsi/srp.h.000   2006-05-22 14:56:51.337237500 -0400
+++ drivers/infiniband/include/scsi/srp.h       2006-05-22 12:03:27.141582521 -0400
@@ -101,8 +101,8 @@
 struct srp_indirect_buf {
        struct srp_direct_buf   table_desc;
        __be32                  len;
-       struct srp_direct_buf   desc_list[0] __attribute__((packed));
-};
+       struct srp_direct_buf   desc_list[0];
+} __attribute__((packed));
 
 enum {
        SRP_MULTICHAN_SINGLE = 0,



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the general mailing list