Commit 5ec5db8d authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka
Browse files

drivers/net: icmp: remove variable-length array


Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
[Jan: adjust comments]
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 0270191f
...@@ -308,13 +308,22 @@ static int rt_icmp_send_request(u32 daddr, struct icmp_bxm *icmp_param) ...@@ -308,13 +308,22 @@ static int rt_icmp_send_request(u32 daddr, struct icmp_bxm *icmp_param)
} }
/*** /***
* rt_icmp_echo_request - sends an echo request to the specified address * rt_icmp_send_echo - sends an echo request to the specified address
*/ */
int rt_icmp_send_echo(u32 daddr, u16 id, u16 sequence, size_t msg_size) int rt_icmp_send_echo(u32 daddr, u16 id, u16 sequence, size_t msg_size)
{ {
struct icmp_bxm icmp_param; struct icmp_bxm icmp_param;
unsigned char pattern_buf[msg_size]; unsigned char *pattern_buf;
off_t pos; off_t pos;
int ret;
/*
* This is just setup of a ping message, exec time is not critical, so
* rtdm_malloc() is ok here.
*/
pattern_buf = rtdm_malloc(msg_size);
if (pattern_buf == NULL)
return -ENOMEM;
/* first purge any potentially pending ICMP fragments */ /* first purge any potentially pending ICMP fragments */
rt_ip_frag_invalidate_socket(icmp_socket); rt_ip_frag_invalidate_socket(icmp_socket);
...@@ -343,7 +352,10 @@ int rt_icmp_send_echo(u32 daddr, u16 id, u16 sequence, size_t msg_size) ...@@ -343,7 +352,10 @@ int rt_icmp_send_echo(u32 daddr, u16 id, u16 sequence, size_t msg_size)
} }
icmp_param.data.buf = pattern_buf; icmp_param.data.buf = pattern_buf;
return rt_icmp_send_request(daddr, &icmp_param); ret = rt_icmp_send_request(daddr, &icmp_param);
rtdm_free(pattern_buf);
return ret;
} }
/*** /***
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment