Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80606
b: refs/heads/master
c: e7847d3
h: refs/heads/master
v: v3
  • Loading branch information
Fabio M. Di Nitto authored and David Teigland committed Jan 30, 2008
1 parent 0131631 commit 9de26d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 39bd4177ddbeb4c86e854d3d5c4a6a26088e601e
refs/heads/master: e7847d35ac39fe92c94540e88ac3d0e177f52d9e
15 changes: 9 additions & 6 deletions trunk/fs/dlm/midcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*******************************************************************************
**
** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
**
** This copyrighted material is made available to anyone wishing to use,
** modify, copy, or redistribute it subject to the terms and conditions
Expand Down Expand Up @@ -58,8 +58,12 @@ static void copy_from_cb(void *dst, const void *base, unsigned offset,
int dlm_process_incoming_buffer(int nodeid, const void *base,
unsigned offset, unsigned len, unsigned limit)
{
unsigned char __tmp[DLM_INBUF_LEN];
struct dlm_header *msg = (struct dlm_header *) __tmp;
union {
unsigned char __buf[DLM_INBUF_LEN];
/* this is to force proper alignment on some arches */
struct dlm_header dlm;
} __tmp;
struct dlm_header *msg = &__tmp.dlm;
int ret = 0;
int err = 0;
uint16_t msglen;
Expand Down Expand Up @@ -100,8 +104,7 @@ int dlm_process_incoming_buffer(int nodeid, const void *base,
in the buffer on the stack (which should work for most
ordinary messages). */

if (msglen > sizeof(__tmp) &&
msg == (struct dlm_header *) __tmp) {
if (msglen > DLM_INBUF_LEN && msg == &__tmp.dlm) {
msg = kmalloc(dlm_config.ci_buffer_size, GFP_KERNEL);
if (msg == NULL)
return ret;
Expand All @@ -119,7 +122,7 @@ int dlm_process_incoming_buffer(int nodeid, const void *base,
dlm_receive_buffer(msg, nodeid);
}

if (msg != (struct dlm_header *) __tmp)
if (msg != &__tmp.dlm)
kfree(msg);

return err ? err : ret;
Expand Down

0 comments on commit 9de26d7

Please sign in to comment.