* [PATCH net-next] net: em_canid: remove useless statements from em_canid_change
@ 2014-06-18 8:48 Duan Jiong
2014-06-21 22:40 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Duan Jiong @ 2014-06-18 8:48 UTC (permalink / raw)
To: Rostislav Lisovy, David Miller; +Cc: netdev
tcf_ematch is allocated by kzalloc in function tcf_em_tree_validate(),
so cm_old is always NULL.
Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
net/sched/em_canid.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/net/sched/em_canid.c b/net/sched/em_canid.c
index bfd34e4..7c292d4 100644
--- a/net/sched/em_canid.c
+++ b/net/sched/em_canid.c
@@ -125,7 +125,6 @@ static int em_canid_change(struct tcf_proto *tp, void *data, int len,
{
struct can_filter *conf = data; /* Array with rules */
struct canid_match *cm;
- struct canid_match *cm_old = (struct canid_match *)m->data;
int i;
if (!len)
@@ -181,12 +180,6 @@ static int em_canid_change(struct tcf_proto *tp, void *data, int len,
m->datalen = sizeof(struct canid_match) + len;
m->data = (unsigned long)cm;
-
- if (cm_old != NULL) {
- pr_err("canid: Configuring an existing ematch!\n");
- kfree(cm_old);
- }
-
return 0;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: em_canid: remove useless statements from em_canid_change
2014-06-18 8:48 [PATCH net-next] net: em_canid: remove useless statements from em_canid_change Duan Jiong
@ 2014-06-21 22:40 ` David Miller
2014-06-22 16:27 ` Oliver Hartkopp
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2014-06-21 22:40 UTC (permalink / raw)
To: duanj.fnst; +Cc: lisovy, netdev
From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Date: Wed, 18 Jun 2014 16:48:39 +0800
> tcf_ematch is allocated by kzalloc in function tcf_em_tree_validate(),
> so cm_old is always NULL.
>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: em_canid: remove useless statements from em_canid_change
2014-06-21 22:40 ` David Miller
@ 2014-06-22 16:27 ` Oliver Hartkopp
2014-06-23 0:27 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Hartkopp @ 2014-06-22 16:27 UTC (permalink / raw)
To: David Miller, duanj.fnst, lisovy; +Cc: netdev
This is right for the first set of filters that is ever configured in
em_canid_change().
But what happens in an update case?
Does is turn the cm_old reference to a memory leak then?
Or do we always get a brand new "struct tcf_ematch *m" here??
Regards,
Oliver
On 22.06.2014 00:40, David Miller wrote:
> From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> Date: Wed, 18 Jun 2014 16:48:39 +0800
>
>> tcf_ematch is allocated by kzalloc in function tcf_em_tree_validate(),
>> so cm_old is always NULL.
>>
>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>
> Applied, thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: em_canid: remove useless statements from em_canid_change
2014-06-22 16:27 ` Oliver Hartkopp
@ 2014-06-23 0:27 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-06-23 0:27 UTC (permalink / raw)
To: socketcan; +Cc: duanj.fnst, lisovy, netdev
From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: Sun, 22 Jun 2014 18:27:34 +0200
> This is right for the first set of filters that is ever configured in
> em_canid_change().
>
> But what happens in an update case?
> Does is turn the cm_old reference to a memory leak then?
>
> Or do we always get a brand new "struct tcf_ematch *m" here??
There is only one call to this method is tcf_em_validate(), which also
unconditionally assigns new pointers to em->data without checking if
an existing non-NULL value is in em->data. Specifically in the code
path where em->ops->change is not implemented.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-23 0:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-18 8:48 [PATCH net-next] net: em_canid: remove useless statements from em_canid_change Duan Jiong
2014-06-21 22:40 ` David Miller
2014-06-22 16:27 ` Oliver Hartkopp
2014-06-23 0:27 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).