<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Sep 17, 2018 at 11:02 PM Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Sep 17, 2018 at 08:55:06PM +0100, Richard W.M. Jones wrote:<br>
> On Mon, Sep 17, 2018 at 10:00:30PM +0300, Nir Soffer wrote:<br>
> > On Mon, Sep 17, 2018 at 6:03 PM Richard W.M. Jones <<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>><br>
> > wrote:<br>
> > <br>
> > > This should have no effect.  However it's probably better to pass the<br>
> > > full type explicitly rather than using an implicit truncation.<br>
> > ><br>
> > <br>
> > Why is it better?<br>
<br>
OK I'll give one (somewhat contrived) example where it might be better<br>
not to rely on implicit truncation of parameters:<br>
<br>
(1) User is compiling on a 32 bit architecture.<br>
<br>
(2) They have turned off or are ignoring compiler warnings.<br>
<br>
(3) The code has forgotten to #include "isaligned.h" (either our code<br>
omits this, which is unlikely, or the user is developing a new plugin<br>
using the same framework).<br>
<br>
In this case the uint64_t would be passed as a 64 bit value (eg.  in<br>
two registers, or as a 64 bit stack entry), and thus the receiving<br>
function would get the wrong parameters.<br></blockquote><div><br></div><div>What if we use uint64_t, and the same careless user sends two 32 bit</div><div>size instead of 64 bit size? We will check the second argument with non-existing</div><div>argument, using some random value from the stack.</div><div><br></div><div>I think we need to put the line somewhere. Users should include headers</div><div>and watch compiler warnings. If not, they deserve the results :-)</div><div> </div><div>Nir</div></div></div>