Re: usbip tools from 5.4 fail to build due to unaligned pointer value warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 03, 2019 at 10:41:41AM +0100, Vadim Troshchinskiy wrote:
> В письме от пятница, 29 ноября 2019 г. 15:17:13 CET пользователь Greg KH написал:
> > On Fri, Nov 29, 2019 at 02:49:45PM +0100, Vadim Troshchinskiy wrote:
> > > В письме от пятница, 29 ноября 2019 г. 14:33:27 CET пользователь Greg KH
> > > 
> > > написал:
> > > > On Fri, Nov 29, 2019 at 01:24:30PM +0100, Vadim Troshchinskiy wrote:
> > > > > Hello,
> > > > > 
> > > > > Building the usbip tools from 4.15 is failing under Fedora 30, gcc
> > > > > version
> > > > 
> > > > > 9.2.1:
> > > > When 4.15 was released, there was no such gcc version :)
> > > > 
> > > > 4.15 is long end-of-life, please use a more modern kernel release with
> > > > newer versions of gcc.
> > > 
> > > Ah, my apologies, had a bit of a mix-up here. This compilation problem was
> > > on v5.4 as it says in the title, I'm working on porting something from
> > > 4.15 and accidentally put that there.
> > 
> > Ah, sorry about that.
> > 
> > Send patches on, odds are no one has tried this yet.
> 
> Okay, how does this look?
> 
> 
> >From db04ae3c88f605f900cf4e9d7a27a849bf6222a3 Mon Sep 17 00:00:00 2001
> From: Vadim Troshchinskiy <vtroshchinskiy@xxxxxxxxxx>
> Date: Tue, 3 Dec 2019 10:31:25 +0100
> Subject: [PATCH] Remove unaligned pointer usage from usbip tools.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> The usbip tools use packed structs for network communication. Taking the
> address of a packed member of a struct can crash the program with SIGBUS
> on architectures with strict alignment requirements.
> 
> Also, recent versions of GCC detect this situation and emit a warning that
> is fatal due to -Werror being used.
> 
> error: taking address of packed member of ‘struct
> usbip_usb_device’ may result in an unaligned pointer value [-Werror=address-
> of-packed-member]
> 
> Fix this by copying the data to an aligned location and operating there.
> ---
>  tools/usb/usbip/src/usbip_network.c | 30 +++++++++++++++--------------
>  tools/usb/usbip/src/usbip_network.h | 12 ++++++------
>  2 files changed, 22 insertions(+), 20 deletions(-)

Can you resend this in a format that I can apply it, with a correct
signed-off-by and copying the usbip maintainer as well?

thanks,

greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux