All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: David Ahern <david.ahern-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] IB/core: Fix unaligned accesses
Date: Fri, 1 May 2015 10:57:18 -0600	[thread overview]
Message-ID: <20150501165718.GA17940@obsidianresearch.com> (raw)
In-Reply-To: <5543AACF.7060502-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

On Fri, May 01, 2015 at 10:33:19AM -0600, David Ahern wrote:
> On 5/1/15 10:24 AM, Jason Gunthorpe wrote:
> >>-		data_cmp = cm_compare_private_data(private_data,
> >>+		data_cmp = cm_compare_private_data((u32 *) private_data,
> >>  						   cm_id_priv->compare_data);
> >
> >I'd be happier without this cast, at the worst move it up one more
> >layer, at the best, fix the two impacted structures as well.
> 
> I tried to fix private_data and it blows the patch up.

Add this:

diff --git a/drivers/infiniband/core/cm_msgs.h b/drivers/infiniband/core/cm_msgs.h
index be068f47e47e..a1e8cbf0a234 100644
--- a/drivers/infiniband/core/cm_msgs.h
+++ b/drivers/infiniband/core/cm_msgs.h
@@ -103,7 +103,7 @@ struct cm_req_msg {
        /* local ACK timeout:5, rsvd:3 */
        u8 alt_offset139;
 
-       u8 private_data[IB_CM_REQ_PRIVATE_DATA_SIZE];
+       u32 private_data[IB_CM_REQ_PRIVATE_DATA_SIZE/4];
 
 } __attribute__ ((packed));
 
@@ -801,7 +801,7 @@ struct cm_sidr_req_msg {
        __be16 rsvd;
        __be64 service_id;
 
-       u8 private_data[IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE];
+       u32 private_data[IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE/4];
 } __attribute__ ((packed));
 
 struct cm_sidr_rep_msg {
 
> >>I feel like I stepped into a tar pit... It's a bit odd that
> >>IB_CM_COMPARE_SIZE is part of an enum rather than a #define.
> >
> >This is, again, idiomatic. '#define CONSTANT' is often frowned upon,
> >the semantics of enum are much cleaner/safer,
> 
> '#define NAME VALUE' is used throughout the kernel. Why does ib_rdma
> need to be different?

There is a mix, the style guide endorses both options.
 
> >To look for more sketchy things that might impact SPARC, ARM, etc.
> 
> Seems like a topic for another patch.

Yep

Jason
--
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

      parent reply	other threads:[~2015-05-01 16:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01  2:42 [PATCH v2] IB/core: Fix unaligned accesses David Ahern
     [not found] ` <1430448168-38479-1-git-send-email-david.ahern-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-05-01  8:45   ` Yann Droneaud
     [not found]     ` <1430469925.2957.14.camel-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2015-05-01 14:27       ` David Ahern
2015-05-01  9:50   ` Bart Van Assche
     [not found]     ` <55434C62.6050604-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-05-01 14:28       ` David Ahern
2015-05-01 16:24   ` Jason Gunthorpe
     [not found]     ` <20150501162413.GC8531-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-05-01 16:33       ` David Ahern
     [not found]         ` <5543AACF.7060502-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-05-01 16:57           ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150501165718.GA17940@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=david.ahern-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.