Skip to content

Commit 359d96e

Browse files
bjking1James Bottomley
authored andcommitted
ipr: Endian / sparse fixes
Some misc fixes for endianness checking with sparse so sparse with endian checking now runs clean. Fixes a minor bug in the process which was uncovered by sparse which would result in unnecessary error recovery for check conditions. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Reviewed-by: Wen Xiong <wenxiong@linux.vnet.ibm.com> Signed-off-by: James Bottomley <JBottomley@Odin.com>
1 parent bb8647e commit 359d96e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

drivers/scsi/ipr.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,8 @@ static void ipr_init_res_entry(struct ipr_resource_entry *res,
11651165

11661166
if (ioa_cfg->sis64) {
11671167
proto = cfgtew->u.cfgte64->proto;
1168-
res->res_flags = cfgtew->u.cfgte64->res_flags;
1168+
res->flags = be16_to_cpu(cfgtew->u.cfgte64->flags);
1169+
res->res_flags = be16_to_cpu(cfgtew->u.cfgte64->res_flags);
11691170
res->qmodel = IPR_QUEUEING_MODEL64(res);
11701171
res->type = cfgtew->u.cfgte64->res_type;
11711172

@@ -1313,8 +1314,8 @@ static void ipr_update_res_entry(struct ipr_resource_entry *res,
13131314
int new_path = 0;
13141315

13151316
if (res->ioa_cfg->sis64) {
1316-
res->flags = cfgtew->u.cfgte64->flags;
1317-
res->res_flags = cfgtew->u.cfgte64->res_flags;
1317+
res->flags = be16_to_cpu(cfgtew->u.cfgte64->flags);
1318+
res->res_flags = be16_to_cpu(cfgtew->u.cfgte64->res_flags);
13181319
res->type = cfgtew->u.cfgte64->res_type;
13191320

13201321
memcpy(&res->std_inq_data, &cfgtew->u.cfgte64->std_inq_data,
@@ -1900,7 +1901,7 @@ static void ipr_log_array_error(struct ipr_ioa_cfg *ioa_cfg,
19001901
* Return value:
19011902
* none
19021903
**/
1903-
static void ipr_log_hex_data(struct ipr_ioa_cfg *ioa_cfg, u32 *data, int len)
1904+
static void ipr_log_hex_data(struct ipr_ioa_cfg *ioa_cfg, __be32 *data, int len)
19041905
{
19051906
int i;
19061907

@@ -2270,7 +2271,7 @@ static void ipr_log_fabric_error(struct ipr_ioa_cfg *ioa_cfg,
22702271
((unsigned long)fabric + be16_to_cpu(fabric->length));
22712272
}
22722273

2273-
ipr_log_hex_data(ioa_cfg, (u32 *)fabric, add_len);
2274+
ipr_log_hex_data(ioa_cfg, (__be32 *)fabric, add_len);
22742275
}
22752276

22762277
/**
@@ -2364,7 +2365,7 @@ static void ipr_log_sis64_fabric_error(struct ipr_ioa_cfg *ioa_cfg,
23642365
((unsigned long)fabric + be16_to_cpu(fabric->length));
23652366
}
23662367

2367-
ipr_log_hex_data(ioa_cfg, (u32 *)fabric, add_len);
2368+
ipr_log_hex_data(ioa_cfg, (__be32 *)fabric, add_len);
23682369
}
23692370

23702371
/**

drivers/scsi/ipr.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,13 @@ struct ipr_hostrcb_type_24_error {
10051005
struct ipr_hostrcb_type_07_error {
10061006
u8 failure_reason[64];
10071007
struct ipr_vpd vpd;
1008-
u32 data[222];
1008+
__be32 data[222];
10091009
}__attribute__((packed, aligned (4)));
10101010

10111011
struct ipr_hostrcb_type_17_error {
10121012
u8 failure_reason[64];
10131013
struct ipr_ext_vpd vpd;
1014-
u32 data[476];
1014+
__be32 data[476];
10151015
}__attribute__((packed, aligned (4)));
10161016

10171017
struct ipr_hostrcb_config_element {
@@ -1289,18 +1289,17 @@ struct ipr_resource_entry {
12891289
(((res)->bus << 24) | ((res)->target << 8) | (res)->lun)
12901290

12911291
u8 ata_class;
1292-
1293-
u8 flags;
1294-
__be16 res_flags;
1295-
12961292
u8 type;
12971293

1294+
u16 flags;
1295+
u16 res_flags;
1296+
12981297
u8 qmodel;
12991298
struct ipr_std_inq_data std_inq_data;
13001299

13011300
__be32 res_handle;
13021301
__be64 dev_id;
1303-
__be64 lun_wwn;
1302+
u64 lun_wwn;
13041303
struct scsi_lun dev_lun;
13051304
u8 res_path[8];
13061305

0 commit comments

Comments
 (0)