RE: [PATCH 15/24] scsi: merge print_opcode_name()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Hannes Reinecke [mailto:hare@xxxxxxx]
> +struct sa_name_list {
> +	int cmd;
> +	const struct value_name_pair *arr;
> +	int arr_sz;
> +};

The suggestion to rename cmd to opcode in patch 14 would
follow the movements here.

...
> @@ -273,7 +292,7 @@ static bool scsi_opcode_sa_name(int cmd, int
> service_action,
>  	const struct value_name_pair *arr = NULL;
>  	int arr_sz, k;
> 
> -	for (k = 0; sa_name_ptr->arr; ++k, ++sa_name_ptr) {
> +	for (k = 0; k < ARRAY_SIZE(sa_names_arr); ++k, ++sa_name_ptr) {
>  		if (sa_name_ptr->cmd == cmd) {
>  			arr = sa_name_ptr->arr;
>  			arr_sz = sa_name_ptr->arr_sz;
> @@ -315,11 +334,14 @@ static void print_opcode_name(unsigned char * cdbp, int
> cdb_len)
> 
>  	if (!scsi_opcode_sa_name(cdb0, sa, &name)) {
>  		if (cdb0 < 0xc0) {
> -			name = cdb_byte0_names[cdb0];
> -			if (name)
> -				printk("%s", name);
> -			else
> -				printk("cdb[0]=0x%x (reserved)", cdb0);
> +			if (ARRAY_SIZE(cdb_byte0_names)) {
> +				name = cdb_byte0_names[cdb0];
> +				if (name)
> +					printk("%s", name);
> +				else
> +					printk("cdb[0]=0x%x (reserved)", cdb0);
> +			} else
> +				printk("cdb[0]=0x%x", cdb0);

Just ARRAY_SIZE(cdb_byte0_names) is not right - that array 
is always defined and the statement is always true.

Patch 16 replaces that block of code and eliminates that
issue.


---
Rob Elliott    HP Server Storage



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux