Hi,
On Fri, Nov 13, 2020 at 5:58 PM Alexander Aring <[email protected]> wrote: > > This patch removes unaligned memory access handling for receiving > midcomms messages. The allocated receive buffer is always memory aligned > as the code shows, but each dlm message length and their structure fields > are always aligned to 4 bytes addresses so it should be fine to remove > this special handling. > > Signed-off-by: Alexander Aring <[email protected]> > --- > fs/dlm/midcomms.c | 12 +----------- > 1 file changed, 1 insertion(+), 11 deletions(-) > > diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c > index e058e017c77d..b146842be54a 100644 > --- a/fs/dlm/midcomms.c > +++ b/fs/dlm/midcomms.c > @@ -22,8 +22,6 @@ > * into packets and sends them to the comms layer. > */ > > -#include <asm/unaligned.h> > - > #include "dlm_internal.h" > #include "lowcomms.h" > #include "config.h" > @@ -96,7 +94,7 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char > *buf, int len) > /* no message should be more than this otherwise we > * cannot deliver this message to upper layers > */ > - msglen = get_unaligned_le16(&hd->h_length); > + msglen = le16_to_cpu(hd->h_length); > if (msglen > DEFAULT_BUFFER_SIZE) { I will change this condition to: if (msglen > DEFAULT_BUFFER_SIZE || msglen < sizeof(struct dlm_header) || DLM_MSGLEN_IS_NOT_ALIGNED(msglen)) { As these must always be true for a valid dlm message, we disconnect when seeing such a message. We cannot skip it because skipping requires a valid msglen. - Alex
