Skip to content

Commit

Permalink
isdn: clean up debug format string usage
Browse files Browse the repository at this point in the history
Avoid unneeded local string buffers for constructing debug output.  Also
cleans up debug calls that contain a single parameter so that they cannot
be accidentally parsed as format strings.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Kees Cook authored and David S. Miller committed Sep 14, 2013
1 parent a2a69f0 commit 35a4a57
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 79 deletions.
4 changes: 2 additions & 2 deletions drivers/isdn/hisax/amd7930_fn.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Amd7930_empty_Dfifo(struct IsdnCardState *cs, int flag)

t += sprintf(t, "Amd7930: empty_Dfifo cnt: %d |", cs->rcvidx);
QuickHex(t, cs->rcvbuf, cs->rcvidx);
debugl1(cs, cs->dlog);
debugl1(cs, "%s", cs->dlog);
}
/* moves received data in sk-buffer */
memcpy(skb_put(skb, cs->rcvidx), cs->rcvbuf, cs->rcvidx);
Expand Down Expand Up @@ -406,7 +406,7 @@ Amd7930_fill_Dfifo(struct IsdnCardState *cs)

t += sprintf(t, "Amd7930: fill_Dfifo cnt: %d |", count);
QuickHex(t, deb_ptr, count);
debugl1(cs, cs->dlog);
debugl1(cs, "%s", cs->dlog);
}
/* AMD interrupts on */
AmdIrqOn(cs);
Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/hisax/avm_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ hdlc_empty_fifo(struct BCState *bcs, int count)
t += sprintf(t, "hdlc_empty_fifo %c cnt %d",
bcs->channel ? 'B' : 'A', count);
QuickHex(t, p, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down Expand Up @@ -345,7 +345,7 @@ hdlc_fill_fifo(struct BCState *bcs)
t += sprintf(t, "hdlc_fill_fifo %c cnt %d",
bcs->channel ? 'B' : 'A', count);
QuickHex(t, p, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/isdn/hisax/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if)
ptr--;
*ptr++ = '\n';
*ptr = 0;
HiSax_putstatus(cs, NULL, cs->dlog);
HiSax_putstatus(cs, NULL, "%s", cs->dlog);
} else
HiSax_putstatus(cs, "LogEcho: ",
"warning Frame too big (%d)",
Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/hisax/diva.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ Memhscx_empty_fifo(struct BCState *bcs, int count)
t += sprintf(t, "hscx_empty_fifo %c cnt %d",
bcs->hw.hscx.hscx ? 'B' : 'A', count);
QuickHex(t, ptr, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down Expand Up @@ -469,7 +469,7 @@ Memhscx_fill_fifo(struct BCState *bcs)
t += sprintf(t, "hscx_fill_fifo %c cnt %d",
bcs->hw.hscx.hscx ? 'B' : 'A', count);
QuickHex(t, ptr, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/isdn/hisax/elsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ check_arcofi(struct IsdnCardState *cs)
t = tmp;
t += sprintf(tmp, "Arcofi data");
QuickHex(t, p, cs->dc.isac.mon_rxp);
debugl1(cs, tmp);
debugl1(cs, "%s", tmp);
if ((cs->dc.isac.mon_rxp == 2) && (cs->dc.isac.mon_rx[0] == 0xa0)) {
switch (cs->dc.isac.mon_rx[1]) {
case 0x80:
Expand Down
2 changes: 1 addition & 1 deletion drivers/isdn/hisax/elsa_ser.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static inline void receive_chars(struct IsdnCardState *cs,

t += sprintf(t, "modem read cnt %d", cs->hw.elsa.rcvcnt);
QuickHex(t, cs->hw.elsa.rcvbuf, cs->hw.elsa.rcvcnt);
debugl1(cs, tmp);
debugl1(cs, "%s", tmp);
}
cs->hw.elsa.rcvcnt = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/isdn/hisax/hfc_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ receive_emsg(struct IsdnCardState *cs)
ptr--;
*ptr++ = '\n';
*ptr = 0;
HiSax_putstatus(cs, NULL, cs->dlog);
HiSax_putstatus(cs, NULL, "%s", cs->dlog);
} else
HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", total - 3);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/isdn/hisax/hfc_sx.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ receive_emsg(struct IsdnCardState *cs)
ptr--;
*ptr++ = '\n';
*ptr = 0;
HiSax_putstatus(cs, NULL, cs->dlog);
HiSax_putstatus(cs, NULL, "%s", cs->dlog);
} else
HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", skb->len);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/hisax/hscx_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ hscx_empty_fifo(struct BCState *bcs, int count)
t += sprintf(t, "hscx_empty_fifo %c cnt %d",
bcs->hw.hscx.hscx ? 'B' : 'A', count);
QuickHex(t, ptr, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down Expand Up @@ -115,7 +115,7 @@ hscx_fill_fifo(struct BCState *bcs)
t += sprintf(t, "hscx_fill_fifo %c cnt %d",
bcs->hw.hscx.hscx ? 'B' : 'A', count);
QuickHex(t, ptr, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/hisax/icc.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ icc_empty_fifo(struct IsdnCardState *cs, int count)

t += sprintf(t, "icc_empty_fifo cnt %d", count);
QuickHex(t, ptr, count);
debugl1(cs, cs->dlog);
debugl1(cs, "%s", cs->dlog);
}
}

Expand Down Expand Up @@ -176,7 +176,7 @@ icc_fill_fifo(struct IsdnCardState *cs)

t += sprintf(t, "icc_fill_fifo cnt %d", count);
QuickHex(t, ptr, count);
debugl1(cs, cs->dlog);
debugl1(cs, "%s", cs->dlog);
}
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/isdn/hisax/ipacx.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ dch_empty_fifo(struct IsdnCardState *cs, int count)

t += sprintf(t, "dch_empty_fifo() cnt %d", count);
QuickHex(t, ptr, count);
debugl1(cs, cs->dlog);
debugl1(cs, "%s", cs->dlog);
}
}

Expand Down Expand Up @@ -307,7 +307,7 @@ dch_fill_fifo(struct IsdnCardState *cs)

t += sprintf(t, "dch_fill_fifo() cnt %d", count);
QuickHex(t, ptr, count);
debugl1(cs, cs->dlog);
debugl1(cs, "%s", cs->dlog);
}
}

Expand Down Expand Up @@ -539,7 +539,7 @@ bch_empty_fifo(struct BCState *bcs, int count)

t += sprintf(t, "bch_empty_fifo() B-%d cnt %d", hscx, count);
QuickHex(t, ptr, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down Expand Up @@ -582,7 +582,7 @@ bch_fill_fifo(struct BCState *bcs)

t += sprintf(t, "chb_fill_fifo() B-%d cnt %d", hscx, count);
QuickHex(t, ptr, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/hisax/isac.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ isac_empty_fifo(struct IsdnCardState *cs, int count)

t += sprintf(t, "isac_empty_fifo cnt %d", count);
QuickHex(t, ptr, count);
debugl1(cs, cs->dlog);
debugl1(cs, "%s", cs->dlog);
}
}

Expand Down Expand Up @@ -179,7 +179,7 @@ isac_fill_fifo(struct IsdnCardState *cs)

t += sprintf(t, "isac_fill_fifo cnt %d", count);
QuickHex(t, ptr, count);
debugl1(cs, cs->dlog);
debugl1(cs, "%s", cs->dlog);
}
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/isdn/hisax/isar.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ sendmsg(struct IsdnCardState *cs, u_char his, u_char creg, u_char len,
t = tmp;
t += sprintf(t, "sendmbox cnt %d", len);
QuickHex(t, &msg[len-i], (i > 64) ? 64 : i);
debugl1(cs, tmp);
debugl1(cs, "%s", tmp);
i -= 64;
}
}
Expand Down Expand Up @@ -105,7 +105,7 @@ rcv_mbox(struct IsdnCardState *cs, struct isar_reg *ireg, u_char *msg)
t = tmp;
t += sprintf(t, "rcv_mbox cnt %d", ireg->clsb);
QuickHex(t, &msg[ireg->clsb - i], (i > 64) ? 64 : i);
debugl1(cs, tmp);
debugl1(cs, "%s", tmp);
i -= 64;
}
}
Expand Down Expand Up @@ -1248,7 +1248,7 @@ isar_int_main(struct IsdnCardState *cs)
tp += sprintf(debbuf, "msg iis(%x) msb(%x)",
ireg->iis, ireg->cmsb);
QuickHex(tp, (u_char *)ireg->par, ireg->clsb);
debugl1(cs, debbuf);
debugl1(cs, "%s", debbuf);
}
break;
case ISAR_IIS_INVMSG:
Expand Down
18 changes: 5 additions & 13 deletions drivers/isdn/hisax/jade.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ modejade(struct BCState *bcs, int mode, int bc)
int jade = bcs->hw.hscx.hscx;

if (cs->debug & L1_DEB_HSCX) {
char tmp[40];
sprintf(tmp, "jade %c mode %d ichan %d",
'A' + jade, mode, bc);
debugl1(cs, tmp);
debugl1(cs, "jade %c mode %d ichan %d", 'A' + jade, mode, bc);
}
bcs->mode = mode;
bcs->channel = bc;
Expand Down Expand Up @@ -257,23 +254,18 @@ void
clear_pending_jade_ints(struct IsdnCardState *cs)
{
int val;
char tmp[64];

cs->BC_Write_Reg(cs, 0, jade_HDLC_IMR, 0x00);
cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0x00);

val = cs->BC_Read_Reg(cs, 1, jade_HDLC_ISR);
sprintf(tmp, "jade B ISTA %x", val);
debugl1(cs, tmp);
debugl1(cs, "jade B ISTA %x", val);
val = cs->BC_Read_Reg(cs, 0, jade_HDLC_ISR);
sprintf(tmp, "jade A ISTA %x", val);
debugl1(cs, tmp);
debugl1(cs, "jade A ISTA %x", val);
val = cs->BC_Read_Reg(cs, 1, jade_HDLC_STAR);
sprintf(tmp, "jade B STAR %x", val);
debugl1(cs, tmp);
debugl1(cs, "jade B STAR %x", val);
val = cs->BC_Read_Reg(cs, 0, jade_HDLC_STAR);
sprintf(tmp, "jade A STAR %x", val);
debugl1(cs, tmp);
debugl1(cs, "jade A STAR %x", val);
/* Unmask ints */
cs->BC_Write_Reg(cs, 0, jade_HDLC_IMR, 0xF8);
cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0xF8);
Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/hisax/jade_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jade_empty_fifo(struct BCState *bcs, int count)
t += sprintf(t, "jade_empty_fifo %c cnt %d",
bcs->hw.hscx.hscx ? 'B' : 'A', count);
QuickHex(t, ptr, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down Expand Up @@ -105,7 +105,7 @@ jade_fill_fifo(struct BCState *bcs)
t += sprintf(t, "jade_fill_fifo %c cnt %d",
bcs->hw.hscx.hscx ? 'B' : 'A', count);
QuickHex(t, ptr, count);
debugl1(cs, bcs->blog);
debugl1(cs, "%s", bcs->blog);
}
}

Expand Down
Loading

0 comments on commit 35a4a57

Please sign in to comment.