Fix parse_rtattr() does not completely initialize
Because max is the index of the last element in array tb, max+1 elements need to be initialized. Signed-off-by: Leo Ruan <tingquan.ruan@cn.bosch.com> Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>pull/106/head^2
parent
4ea9ec7cf3
commit
f5392c3654
|
|
@ -74,10 +74,18 @@ struct req_info {
|
|||
struct can_bittiming *bittiming;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief this method parse attributions of link info
|
||||
*
|
||||
* @param tb: point array of struct rtattr point
|
||||
* @param max: index of the last element in array tb
|
||||
* @param rtattr: point of link info data
|
||||
* @param len: length of link info data
|
||||
*/
|
||||
static void
|
||||
parse_rtattr(struct rtattr **tb, int max, struct rtattr *rta, int len)
|
||||
{
|
||||
memset(tb, 0, sizeof(*tb) * max);
|
||||
memset(tb, 0, sizeof(*tb) * (max + 1));
|
||||
while (RTA_OK(rta, len)) {
|
||||
if (rta->rta_type <= max) {
|
||||
tb[rta->rta_type] = rta;
|
||||
|
|
|
|||
Loading…
Reference in New Issue