From: Gao Feng <redacted>
Current xt_osf codes use memcmp to check if two user fingers are same,
so it depends on that the struct xt_osf_user_finger is no padding.
It is one implicit rule, and is not good to maintain.
Now use zero memory and assign the members explicitly.
Signed-off-by: Gao Feng <redacted>
---
net/netfilter/xt_osf.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
Hi Feng,
2016-09-27 12:39 GMT+08:00 [off-list ref]:
quoted hunk
From: Gao Feng <redacted>
Current xt_osf codes use memcmp to check if two user fingers are same,
so it depends on that the struct xt_osf_user_finger is no padding.
It is one implicit rule, and is not good to maintain.
Now use zero memory and assign the members explicitly.
Signed-off-by: Gao Feng <redacted>
---
net/netfilter/xt_osf.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
This xt_osf_user_finger{} is carefully designed, no padding now, and
will not be changed in the future, otherwise backward compatibility will
be broken.
I don't think this convert is necessary, actually it is a little ugly, and will
increase the maintenance burden.
Hi Liping,
On Tue, Sep 27, 2016 at 1:49 PM, Liping Zhang [off-list ref] wrote:
Hi Feng,
2016-09-27 12:39 GMT+08:00 [off-list ref]:
quoted
From: Gao Feng <redacted>
Current xt_osf codes use memcmp to check if two user fingers are same,
so it depends on that the struct xt_osf_user_finger is no padding.
It is one implicit rule, and is not good to maintain.
Now use zero memory and assign the members explicitly.
Signed-off-by: Gao Feng <redacted>
---
net/netfilter/xt_osf.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
This xt_osf_user_finger{} is carefully designed, no padding now, and
will not be changed in the future, otherwise backward compatibility will
be broken.
Yes, there is no padding now. So it is ok to use memcmp now.
I am afraid the struct would be modified for other requirements.
If it is never changed forever, it is ok certainly.
I don't think this convert is necessary, actually it is a little ugly, and will
increase the maintenance burden.
I just want the codes don't depend any implicit rule.
It is a tradeoff. If never change, needn't do any convert.
If may change, the memcmp is a little dangerous.
Regards
Feng
Hi Feng,
2016-09-27 14:00 GMT+08:00 Gao Feng [off-list ref]:
Hi Liping,
quoted
This xt_osf_user_finger{} is carefully designed, no padding now, and
will not be changed in the future, otherwise backward compatibility will
be broken.
Yes, there is no padding now. So it is ok to use memcmp now.
I am afraid the struct would be modified for other requirements.
This is structure was passed by netlink attribute, so modify it will
break backward compatibility.
If it is never changed forever, it is ok certainly.
quoted
I don't think this convert is necessary, actually it is a little ugly, and will
increase the maintenance burden.
I just want the codes don't depend any implicit rule.
It is a tradeoff. If never change, needn't do any convert.
If may change, the memcmp is a little dangerous.
Regards
Feng
Hi Liping,
On Tue, Sep 27, 2016 at 2:05 PM, Liping Zhang [off-list ref] wrote:
Hi Feng,
2016-09-27 14:00 GMT+08:00 Gao Feng [off-list ref]:
quoted
Hi Liping,
quoted
This xt_osf_user_finger{} is carefully designed, no padding now, and
will not be changed in the future, otherwise backward compatibility will
be broken.
Yes, there is no padding now. So it is ok to use memcmp now.
I am afraid the struct would be modified for other requirements.
This is structure was passed by netlink attribute, so modify it will
break backward compatibility.
Reasonable.
Thanks Liping.
Regards
Feng
quoted
If it is never changed forever, it is ok certainly.
quoted
I don't think this convert is necessary, actually it is a little ugly, and will
increase the maintenance burden.
I just want the codes don't depend any implicit rule.
It is a tradeoff. If never change, needn't do any convert.
If may change, the memcmp is a little dangerous.
Regards
Feng