File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -109,19 +109,22 @@ qla2x00_set_fcport_disc_state(fc_port_t *fcport, int state)
109
109
{
110
110
int old_val ;
111
111
uint8_t shiftbits , mask ;
112
+ uint8_t port_dstate_str_sz ;
112
113
113
114
/* This will have to change when the max no. of states > 16 */
114
115
shiftbits = 4 ;
115
116
mask = (1 << shiftbits ) - 1 ;
116
117
118
+ port_dstate_str_sz = sizeof (port_dstate_str ) / sizeof (char * );
117
119
fcport -> disc_state = state ;
118
120
while (1 ) {
119
121
old_val = atomic_read (& fcport -> shadow_disc_state );
120
122
if (old_val == atomic_cmpxchg (& fcport -> shadow_disc_state ,
121
123
old_val , (old_val << shiftbits ) | state )) {
122
124
ql_dbg (ql_dbg_disc , fcport -> vha , 0x2134 ,
123
125
"FCPort %8phC disc_state transition: %s to %s - portid=%06x.\n" ,
124
- fcport -> port_name , port_dstate_str [old_val & mask ],
126
+ fcport -> port_name , (old_val & mask ) < port_dstate_str_sz ?
127
+ port_dstate_str [old_val & mask ] : "Unknown" ,
125
128
port_dstate_str [state ], fcport -> d_id .b24 );
126
129
return ;
127
130
}
You can’t perform that action at this time.
0 commit comments