From: <joe...@sy...> - 2007-10-29 10:40:40
|
Ming Zhang wrote: > off topic, could you resubmit the alignment issue patch to list and see > if tomof accept. he needs a patch inlined in email. it is found and > fixed by you, so had better you post it (instead of me). thx. diff -u kernel.old/iscsi.c kernel/iscsi.c --- kernel.old/iscsi.c 2007-10-29 09:49:16.000000000 +0100 +++ kernel/iscsi.c 2007-10-17 11:19:14.000000000 +0200 @@ -726,13 +726,26 @@ case READ_10: case WRITE_10: case WRITE_VERIFY: - *off = be32_to_cpu(*(u32 *)&cmd[2]); + *off = be32_to_cpu((((u32) cmd[2]) << 24) | + (((u32) cmd[3]) << 16) | + (((u32) cmd[4]) << 8) | + cmd[5]); *len = (cmd[7] << 8) + cmd[8]; break; case READ_16: case WRITE_16: - *off = be64_to_cpu(*(u64 *)&cmd[2]); - *len = be32_to_cpu(*(u32 *)&cmd[10]); + *off = be32_to_cpu((((u64) cmd[2]) << 56) | + (((u64) cmd[3]) << 48) | + (((u64) cmd[4]) << 40) | + (((u64) cmd[5]) << 32) | + (((u64) cmd[6]) << 24) | + (((u64) cmd[7]) << 16) | + (((u64) cmd[8]) << 8) | + cmd[9]); + *len = be32_to_cpu((((u32) cmd[10]) << 24) | + (((u32) cmd[11]) << 16) | + (((u32) cmd[12]) << 8) | + cmd[13]); break; default: BUG(); diff -u kernel.old/target_disk.c kernel/target_disk.c --- kernel.old/target_disk.c 2007-10-29 09:49:16.000000000 +0100 +++ kernel/target_disk.c 2007-10-17 16:04:06.000000000 +0200 @@ -66,13 +66,15 @@ unsigned char geo_m_pg[] = {0x04, 0x16, 0x00, 0x00, 0x00, 0x40, 0x00, 0x 00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x 00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x98, 0x00, 0x 00}; - u32 ncyl, *p; + u32 ncyl; + u32 n; /* assume 0xff heads, 15krpm. */ memcpy(ptr, geo_m_pg, sizeof(geo_m_pg)); ncyl = sec >> 14; /* 256 * 64 */ - p = (u32 *)(ptr + 1); - *p = *p | cpu_to_be32(ncyl); + memcpy(&n,ptr+1,sizeof(u32)); + n = n | cpu_to_be32(ncyl); + memcpy(ptr+1, &n, sizeof(u32)); return sizeof(geo_m_pg); } @@ -249,7 +251,10 @@ struct iet_volume *lun; int rest, idx = 0; - size = be32_to_cpu(*(u32 *)&req->scb[6]); + size = be32_to_cpu((((u32) req->scb[6]) << 24) | + (((u32) req->scb[7]) << 16) | + (((u32) req->scb[8]) << 8) | + req->scb[9]); if (size < 16) return -1; Regards, JKB |