From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757958AbYELNPJ (ORCPT ); Mon, 12 May 2008 09:15:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754186AbYELNO6 (ORCPT ); Mon, 12 May 2008 09:14:58 -0400 Received: from senator.holtmann.net ([87.106.208.187]:37385 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753564AbYELNO6 (ORCPT ); Mon, 12 May 2008 09:14:58 -0400 Subject: Re: [PATCH 1/1] [net/irda]: Fix a misalign access issue. From: Marcel Holtmann To: Bryan Wu Cc: samuel@sortiz.org, irda-users@lists.sourceforge.net, linux-kernel@vger.kernel.org, Graf Yang In-Reply-To: <1210588521-11508-1-git-send-email-cooloney@kernel.org> References: <1210588521-11508-1-git-send-email-cooloney@kernel.org> Content-Type: text/plain Date: Mon, 12 May 2008 15:15:08 +0200 Message-Id: <1210598108.16390.47.camel@violet.holtmann.net> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bryan, > From: Graf Yang > > Signed-off-by: Graf Yang > Signed-off-by: Bryan Wu > --- > net/irda/discovery.c | 8 +++++--- > net/irda/irlmp.c | 2 +- > 2 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/net/irda/discovery.c b/net/irda/discovery.c > index bfacef8..a6f99b5 100644 > --- a/net/irda/discovery.c > +++ b/net/irda/discovery.c > @@ -40,6 +40,8 @@ > > #include > > +#include > + > /* > * Function irlmp_add_discovery (cachelog, discovery) > * > @@ -87,7 +89,7 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new) > */ > hashbin_remove_this(cachelog, (irda_queue_t *) node); > /* Check if hints bits are unchanged */ > - if(u16ho(node->data.hints) == u16ho(new->data.hints)) > + if (get_unaligned((__u16 *)node->data.hints) == get_unaligned((__u16 *)new->data.hints)) > /* Set time of first discovery for this node */ > new->firststamp = node->firststamp; > kfree(node); > @@ -281,9 +283,9 @@ struct irda_device_info *irlmp_copy_discoveries(hashbin_t *log, int *pn, > /* Mask out the ones we don't want : > * We want to match the discovery mask, and to get only > * the most recent one (unless we want old ones) */ > - if ((u16ho(discovery->data.hints) & mask) && > + if ((get_unaligned((__u16 *)discovery->data.hints) & mask) && > ((old_entries) || > - ((jiffies - discovery->firststamp) < j_timeout)) ) { > + ((jiffies - discovery->firststamp) < j_timeout))) { > /* Create buffer as needed. > * As this function get called a lot and most time > * we don't have anything to put in the log (we are > diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c > index 1f81f8e..7b95cd6 100644 > --- a/net/irda/irlmp.c > +++ b/net/irda/irlmp.c > @@ -1086,7 +1086,7 @@ discovery_t *irlmp_get_discovery_response(void) > > IRDA_ASSERT(irlmp != NULL, return NULL;); > > - u16ho(irlmp->discovery_rsp.data.hints) = irlmp->hints.word; > + put_unaligned(irlmp->hints.word, (__u16 *)irlmp->discovery_rsp.data.hints); > > /* > * Set character set for device name (we use ASCII), and what about net/irda/irnet/irnet_irda.c and why not also kill the u16ho macro at the same time. Regards Marcel