On Tue, 11 Nov 2008 06:47:17 -0800 Seokmann Ju <seokmann.ju@xxxxxxxxxx> wrote: > >> + if (!copy_size) > >> + goto pt_error3; > >> + > >> + /* Check for room in outstanding command list. */ > >> + handle = req->current_outstanding_cmd; > >> + for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) { > >> + handle++; > >> + if (handle == MAX_OUTSTANDING_COMMANDS) > >> + handle = 1; > >> + if (!req->outstanding_cmds[handle]) > >> + break; > >> + } > > > > Hmm, needs to check the index overflow here? > I think I've missed your point, here. > Could you please elaborate a bit further? I meant that you need to check index after the loop like this: + /* Check for room in outstanding command list. */ + handle = req->current_outstanding_cmd; + for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) { + handle++; + if (handle == MAX_OUTSTANDING_COMMANDS) + handle = 1; + if (!req->outstanding_cmds[handle]) + break; + } + if (index == MAX_OUTSTANDING_COMMANDS) + goto handle_error; qla2xxx and qla1280 drivers do the similar thing. -- 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