NetBSD-Bugs archive

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

Re: kern/54486: athn driver panics on arm



The following reply was made to PR kern/54486; it has been noted by GNATS.

From: Andreas Gustafsson <gson%gson.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: gson%gson.org@localhost (Andreas Gustafsson)
Subject: Re: kern/54486: athn driver panics on arm
Date: Fri, 23 Aug 2019 22:57:52 +0300

 Looks like gcc is optimizing the memcpy() call on line 2528 of
 src/sys/dev/usb/if_athn_usb.c into an unaligned 32-bit store:
 
                 txf = (struct ar_tx_frame *)&htc[1];
                 memset(txf, 0, sizeof(*txf));
                 txf->data_type = AR_HTC_NORMAL;
                 txf->node_idx = sta_index;
                 txf->vif_idx = 0;
                 txf->tid = tid;
 
 The fields at the beginning and end of *txf are being assigned to, so
 only the middle part really needs the memset()ting, and gcc apparently
 figures the way to do that is to store a 32-bit word of zeros there,
 at an unaligned address.
 
 I would not be surprised if this optimizaion is also breaking other
 parts of the arm kernel.  Does anyone know the right way to fix this?
 -- 
 Andreas Gustafsson, gson%gson.org@localhost
 


Home | Main Index | Thread Index | Old Index