提交 9a438161 编写于 作者: L Laura Abbott 提交者: David S. Miller

mISDN: Remove VLAs

There's an ongoing effort to remove VLAs[1] from the kernel to eventually
turn on -Wvla. Remove the VLAs from the mISDN code by switching to using
kstrdup in one place and using an upper bound in another.
Signed-off-by: NLaura Abbott <labbott@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b16520f7
...@@ -68,12 +68,12 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg) ...@@ -68,12 +68,12 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg)
goto _do; goto _do;
{ {
char _dup[len + 1];
char *dup, *tok, *name, *val; char *dup, *tok, *name, *val;
int tmp; int tmp;
strcpy(_dup, arg); dup = kstrdup(arg, GFP_ATOMIC);
dup = _dup; if (!dup)
return;
while ((tok = strsep(&dup, ","))) { while ((tok = strsep(&dup, ","))) {
if (!strlen(tok)) if (!strlen(tok))
...@@ -89,6 +89,8 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg) ...@@ -89,6 +89,8 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg)
deftaps = tmp; deftaps = tmp;
} }
} }
kfree(dup);
} }
_do: _do:
......
...@@ -279,7 +279,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, ...@@ -279,7 +279,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask,
u16 timebase, u8 *buf, int len) u16 timebase, u8 *buf, int len)
{ {
u8 *p; u8 *p;
u8 frame[len + 32]; u8 frame[MAX_DFRAME_LEN_L1 + 32];
struct socket *socket = NULL; struct socket *socket = NULL;
if (debug & DEBUG_L1OIP_MSG) if (debug & DEBUG_L1OIP_MSG)
...@@ -902,7 +902,11 @@ handle_dmsg(struct mISDNchannel *ch, struct sk_buff *skb) ...@@ -902,7 +902,11 @@ handle_dmsg(struct mISDNchannel *ch, struct sk_buff *skb)
p = skb->data; p = skb->data;
l = skb->len; l = skb->len;
while (l) { while (l) {
ll = (l < L1OIP_MAX_PERFRAME) ? l : L1OIP_MAX_PERFRAME; /*
* This is technically bounded by L1OIP_MAX_PERFRAME but
* MAX_DFRAME_LEN_L1 < L1OIP_MAX_PERFRAME
*/
ll = (l < MAX_DFRAME_LEN_L1) ? l : MAX_DFRAME_LEN_L1;
l1oip_socket_send(hc, 0, dch->slot, 0, l1oip_socket_send(hc, 0, dch->slot, 0,
hc->chan[dch->slot].tx_counter++, p, ll); hc->chan[dch->slot].tx_counter++, p, ll);
p += ll; p += ll;
...@@ -1140,7 +1144,11 @@ handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb) ...@@ -1140,7 +1144,11 @@ handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb)
p = skb->data; p = skb->data;
l = skb->len; l = skb->len;
while (l) { while (l) {
ll = (l < L1OIP_MAX_PERFRAME) ? l : L1OIP_MAX_PERFRAME; /*
* This is technically bounded by L1OIP_MAX_PERFRAME but
* MAX_DFRAME_LEN_L1 < L1OIP_MAX_PERFRAME
*/
ll = (l < MAX_DFRAME_LEN_L1) ? l : MAX_DFRAME_LEN_L1;
l1oip_socket_send(hc, hc->codec, bch->slot, 0, l1oip_socket_send(hc, hc->codec, bch->slot, 0,
hc->chan[bch->slot].tx_counter, p, ll); hc->chan[bch->slot].tx_counter, p, ll);
hc->chan[bch->slot].tx_counter += ll; hc->chan[bch->slot].tx_counter += ll;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册