Re: [PATCH net-next v3] em_canid: Ematch rule to match CAN frames according to their identifiers

Oliver Hartkopp <[email protected]> Mon, 02 Jul 2012 20:03:27 +0200
Newsgroups gmane.linux.network,gmane.linux.can,gmane.linux.network.routing
Message-ID <[email protected]>
One more simplification:


>> +	rulescnt = len / sizeof(struct can_filter);
>> +
>> +	cm = kzalloc(sizeof(struct canid_match) + sizeof(struct can_filter) *
>> +		rulescnt, GFP_KERNEL);


No need to multiply the value again  ... you can take the len value as-is:

cm = kzalloc(sizeof(struct canid_match) + len, GFP_KERNEL);


> 
> *cm is no longer a fixed structure as it was in the first patches.
> 
> Must be:
> 
> m->datalen = sizeof(struct canid_match) + sizeof(struct can_filter) * rulescnt


dito:

m->datalen = sizeof(struct canid_match) + len;

Regards,
Oliver