Messages in this thread | | | Subject | Re: + syscalls-x86-add-__nr_kcmp-syscall-v8.patch added to -mm tree | From | Valdis.Kletnieks@vt ... | Date | Tue, 10 Apr 2012 19:58:49 -0400 |
| |
On Mon, 09 Apr 2012 15:10:27 -0700, Andrew Morton said: > Back on to kcmp.
I've totally forgotten what my original comment(s) on this patch were.. :)
> +/* > + * 0 - equal, i.e. v1 = v2 > + * 1 - less than, i.e. v1 < v2 > + * 2 - greater than, i.e. v1 > v2 > + * 3 - not equal but ordering unavailable (reserved for future) > + */ > +static int kcmp_ptr(void *v1, void *v2, enum kcmp_type type) > +{ > + long ret; > + > + ret = kptr_obfuscate((long)v1, type) - kptr_obfuscate((long)v2, type);
I'm not able to convince myself that "less than" and "greater than" mean anything - do we have a good proof that for all v1 and v2, the obfuscated pointers have the same ordering as the original pointers?
Hmm... consider the simplified example v1 = 5 and v2= 16., and cookies[0] is also 16. Then obfus(v1) == 21, and obfus(v2) == 0, and the ordering is different. So I'm thinking 0 and 3 are the only sane return values?
Or do I need more caffeine?
[unhandled content-type:application/pgp-signature] | |