clean up sprintf and have buffer that won't overflow
This commit is contained in:
parent
7457966f26
commit
571354dc81
@ -44,40 +44,72 @@ static INLINE void
|
||||
isp_prtstst(sp)
|
||||
ispstatusreq_t *sp;
|
||||
{
|
||||
char buf[128];
|
||||
sprintf(buf, "states->");
|
||||
if (sp->req_state_flags & RQSF_GOT_BUS)
|
||||
sprintf(buf, "%s%s", buf, "GOT_BUS ");
|
||||
if (sp->req_state_flags & RQSF_GOT_TARGET)
|
||||
sprintf(buf, "%s%s", buf, "GOT_TGT ");
|
||||
if (sp->req_state_flags & RQSF_SENT_CDB)
|
||||
sprintf(buf, "%s%s", buf, "SENT_CDB ");
|
||||
if (sp->req_state_flags & RQSF_XFRD_DATA)
|
||||
sprintf(buf, "%s%s", buf, "XFRD_DATA ");
|
||||
if (sp->req_state_flags & RQSF_GOT_STATUS)
|
||||
sprintf(buf, "%s%s", buf, "GOT_STS ");
|
||||
if (sp->req_state_flags & RQSF_GOT_SENSE)
|
||||
sprintf(buf, "%s%s", buf, "GOT_SNS ");
|
||||
if (sp->req_state_flags & RQSF_XFER_COMPLETE)
|
||||
sprintf(buf, "%s%s", buf, "XFR_CMPLT ");
|
||||
sprintf(buf, "%s%s", buf, "\n");
|
||||
sprintf(buf, "%s%s", buf, "status->");
|
||||
if (sp->req_status_flags & RQSTF_DISCONNECT)
|
||||
sprintf(buf, "%s%s", buf, "Disconnect ");
|
||||
if (sp->req_status_flags & RQSTF_SYNCHRONOUS)
|
||||
sprintf(buf, "%s%s", buf, "Sync_xfr ");
|
||||
if (sp->req_status_flags & RQSTF_PARITY_ERROR)
|
||||
sprintf(buf, "%s%s", buf, "Parity ");
|
||||
if (sp->req_status_flags & RQSTF_BUS_RESET)
|
||||
sprintf(buf, "%s%s", buf, "Bus_Reset ");
|
||||
if (sp->req_status_flags & RQSTF_DEVICE_RESET)
|
||||
sprintf(buf, "%s%s", buf, "Device_Reset ");
|
||||
if (sp->req_status_flags & RQSTF_ABORTED)
|
||||
sprintf(buf, "%s%s", buf, "Aborted ");
|
||||
if (sp->req_status_flags & RQSTF_TIMEOUT)
|
||||
sprintf(buf, "%s%s", buf, "Timeout ");
|
||||
if (sp->req_status_flags & RQSTF_NEGOTIATION)
|
||||
sprintf(buf, "%s%s", buf, "Negotiation ");
|
||||
char buf[172], *p = buf;
|
||||
sprintf(p, "states->");
|
||||
if (sp->req_state_flags & RQSF_GOT_BUS) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "GOT_BUS ");
|
||||
}
|
||||
if (sp->req_state_flags & RQSF_GOT_TARGET) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "GOT_TGT ");
|
||||
}
|
||||
if (sp->req_state_flags & RQSF_SENT_CDB) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "SENT_CDB ");
|
||||
}
|
||||
if (sp->req_state_flags & RQSF_XFRD_DATA) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "XFRD_DATA ");
|
||||
}
|
||||
if (sp->req_state_flags & RQSF_GOT_STATUS) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "GOT_STS ");
|
||||
}
|
||||
if (sp->req_state_flags & RQSF_GOT_SENSE) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "GOT_SNS ");
|
||||
}
|
||||
if (sp->req_state_flags & RQSF_XFER_COMPLETE) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "XFR_CMPLT ");
|
||||
}
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "\n");
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "status->");
|
||||
if (sp->req_status_flags & RQSTF_DISCONNECT) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "Disconnect ");
|
||||
}
|
||||
if (sp->req_status_flags & RQSTF_SYNCHRONOUS) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "Sync_xfr ");
|
||||
}
|
||||
if (sp->req_status_flags & RQSTF_PARITY_ERROR) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "Parity ");
|
||||
}
|
||||
if (sp->req_status_flags & RQSTF_BUS_RESET) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "Bus_Reset ");
|
||||
}
|
||||
if (sp->req_status_flags & RQSTF_DEVICE_RESET) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "Device_Reset ");
|
||||
}
|
||||
if (sp->req_status_flags & RQSTF_ABORTED) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "Aborted ");
|
||||
}
|
||||
if (sp->req_status_flags & RQSTF_TIMEOUT) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "Timeout ");
|
||||
}
|
||||
if (sp->req_status_flags & RQSTF_NEGOTIATION) {
|
||||
p += strlen(p);
|
||||
sprintf(p, "%s%s", buf, "Negotiation ");
|
||||
}
|
||||
PRINTF(buf, "%s\n", buf);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user