<div dir="ltr"><div>Hello,<br></div><div dir="ltr"><br></div><div dir="ltr">I'm sorry for disturbing, could I ask you to push this patch if it possible? )))<br></div><div dir="ltr"><br></div><div>Regards,</div><div>Andrii.</div><div><br></div><div class="gmail_quote"><div dir="ltr">On Fri, Nov 30, 2018 at 6:19 PM andrey simiklit <<a href="mailto:asimiklit.work@gmail.com">asimiklit.work@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Nov 30, 2018 at 5:49 PM Eric Engestrom <<a href="mailto:eric.engestrom@intel.com" target="_blank">eric.engestrom@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Friday, 2018-11-30 15:47:11 +0000, Lionel Landwerlin wrote:<br>
> On 14/11/2018 16:30, <a href="mailto:asimiklit.work@gmail.com" target="_blank">asimiklit.work@gmail.com</a> wrote:<br>
> > From: Andrii Simiklit <<a href="mailto:andrii.simiklit@globallogic.com" target="_blank">andrii.simiklit@globallogic.com</a>><br>
> > <br>
> > 1. tools/i965_disasm.c:58:4: warning:<br>
> > ignoring return value of ‘fread’,<br>
> > declared with attribute warn_unused_result<br>
> > fread(assembly, *end, 1, fp);<br>
> > <br>
> > v2: Fixed incorrect return value check.<br>
> > ( Eric Engestrom <<a href="mailto:eric.engestrom@intel.com" target="_blank">eric.engestrom@intel.com</a>> )<br>
> > <br>
> > v3: Zero size file check placed before fread with exit()<br>
> > ( Eric Engestrom <<a href="mailto:eric.engestrom@intel.com" target="_blank">eric.engestrom@intel.com</a>> )<br>
> > <br>
> > v4: - Title is changed.<br>
> > - The 'size' variable was moved to top of a function scope.<br>
> > - The assertion was replaced by the proper error handling.<br>
> > - The error message on a caller side was fixed.<br>
> > ( Eric Engestrom <<a href="mailto:eric.engestrom@intel.com" target="_blank">eric.engestrom@intel.com</a>> )<br>
> > <br>
> > Signed-off-by: Andrii Simiklit <<a href="mailto:andrii.simiklit@globallogic.com" target="_blank">andrii.simiklit@globallogic.com</a>><br>
> <br>
> <br>
> With the nit below :<br>
> <br>
> <br>
> Reviewed-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>><br>
<br>
I'll change that as I push it in a minute :)<br>
Reviewed-by: Eric Engestrom <<a href="mailto:eric.engestrom@intel.com" target="_blank">eric.engestrom@intel.com</a>><br></blockquote><div><br></div><div>Thanks a lot for reviews :)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> <br>
> <br>
> > ---<br>
> > src/intel/tools/i965_disasm.c | 16 +++++++++++++---<br>
> > 1 file changed, 13 insertions(+), 3 deletions(-)<br>
> > <br>
> > diff --git a/src/intel/tools/i965_disasm.c b/src/intel/tools/i965_disasm.c<br>
> > index 73a6760fc1..0efbdab706 100644<br>
> > --- a/src/intel/tools/i965_disasm.c<br>
> > +++ b/src/intel/tools/i965_disasm.c<br>
> > @@ -47,17 +47,23 @@ i965_disasm_get_file_size(FILE *fp)<br>
> > static void *<br>
> > i965_disasm_read_binary(FILE *fp, size_t *end)<br>
> > {<br>
> > + size_t size;<br>
> > void *assembly;<br>
> > *end = i965_disasm_get_file_size(fp);<br>
> > + if (!*end)<br>
> > + return NULL;<br>
> > assembly = malloc(*end + 1);<br>
> > if (assembly == NULL)<br>
> > return NULL;<br>
> > - fread(assembly, *end, 1, fp);<br>
> > + size = fread(assembly, *end, 1, fp);<br>
> > fclose(fp);<br>
> > -<br>
> > + if (!size) {<br>
> > + free(assembly);<br>
> > + return NULL;<br>
> > + }<br>
> > return assembly;<br>
> > }<br>
> > @@ -167,7 +173,11 @@ int main(int argc, char *argv[])<br>
> > assembly = i965_disasm_read_binary(fp, &end);<br>
> > if (!assembly) {<br>
> > - fprintf(stderr, "Unable to allocate buffer to read binary file\n");<br>
> > + if(end)<br>
> if (end)<br>
> > + fprintf(stderr, "Unable to allocate buffer to read binary file\n");<br>
> > + else<br>
> > + fprintf(stderr, "Input file is empty\n");<br>
> > +<br>
> > exit(EXIT_FAILURE);<br>
> > }<br>
> <br>
> <br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div></div>
</blockquote></div></div>