[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211022092110.d2mcmf2qe2jtkld4@viti.kaiser.cx>
Date: Fri, 22 Oct 2021 11:21:10 +0200
From: Martin Kaiser <lists@...ser.cx>
To: Michael Straube <straube.linux@...il.com>
Cc: Phillip Potter <phil@...lpotter.co.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Larry Finger <Larry.Finger@...inger.net>,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/5] staging: r8188eu: use helper to check for broadcast
address
Thus wrote Michael Straube (straube.linux@...il.com):
> > > + !is_broadcast_ether_addr(GetAddr1Ptr(pframe)))
> Hi Martin,
> I'm not an expert regarding alignment. Is GetAddr1Ptr(pframe) always
> __aligned(2) as required by is_broadcast_ether_addr?
Hi Michael,
thanks for spotting this. To be honest, I didn't look at this in much
detail when I wrote the patch.
I suppose the pframe comes from recvbuf2recvframe().
precvframe = rtw_alloc_recvframe(pfree_recv_queue);
with
struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue;
This should be initialised in _rtw_init_recv_priv().
rtw_init_queue(&precvpriv->free_recv_queue);
...
precvpriv->precv_frame_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ);
precvframe = (struct recv_frame *)precvpriv->precv_frame_buf;
and the frames are added to the free_recv_queue.
RXFRAME_ALIGN_SZ is 1<<8.
So pframe should be 256-byte aligned.
GetAddr1Ptr adds 4 to the start of pframe.
I guess we're safe here.
> > > @@ -841,7 +840,7 @@ void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm)
> > > psta = pDM_Odm->pODM_StaInfo[i];
> > > if (IS_STA_VALID(psta) &&
> > > (psta->state & WIFI_ASOC_STATE) &&
> > > - memcmp(psta->hwaddr, bcast_addr, ETH_ALEN) &&
> > > + !is_broadcast_ether_addr(psta->hwaddr) &&
> Perhaps we should add __aligned(2) to the hwaddr variable in struct
> sta_info to be safe?
> u8 hwaddr[ETH_ALEN] __aligned(2);
Hmm, some of those arrays in other parts of the kernel have
__aligned(2), others don't...
Can anyone else give some guidance?
Thanks,
Martin
Powered by blists - more mailing lists