Go to previous topic
Go to next topic
Last Post 30 May 2018 11:52 AM by  Marco Fonseca
null pointer exceptions in logicpd-new-productid.c
 3 Replies
Author Messages
Marco Fonseca
New Member
New Member
Posts:15


--
23 May 2018 04:51 PM

    Not sure where to report bugs, here as good as any other?

    The error path causes null pointer exceptions.  Something like below is needed.

    --- a/logicpd-new-productid.c   2018-05-23 17:38:32.678514618 -0400                                                                           
    +++ b/logicpd-new-productid.c   2018-05-23 16:42:17.607646256 -0400                                                                           
    @@ -1399,7 +1399,6 @@
         struct file *f;
         mm_segment_t fs;
         loff_t pos = 0;
    -    int ret = 0;
         long sz;
     
         struct id_header hdr;
    @@ -1407,7 +1406,7 @@
     
     
         f = filp_open(EEPROM_PATH, O_RDONLY, 0);
    -    if(f == NULL)
    +    if(IS_ERR(f))
             printk(KERN_ALERT "filp_open error!!.\n");
         else{
             fs = get_fs();
    @@ -1437,9 +1436,10 @@
             sz = hdr.data_length;
             vfs_read(f, (void *)&id_data_buf[sizeof(hdr) + sizeof(xsums)], sz, &pos);
             set_fs(fs);
    -    }
         filp_close(f,NULL);
    -    return ret;
    +        return 0;
    +    }
    +    return -1;
     }
     #endif
     

    Adam Ford
    Advanced Member
    Advanced Member
    Posts:793


    --
    29 May 2018 07:26 AM
    Thank you for the patch.

    Can you tell me which BSP your patch is fixing? I'd like to enter it into our bug tracking system for review.

    thank you,

    adam
    Marco Fonseca
    New Member
    New Member
    Posts:15


    --
    30 May 2018 11:51 AM

    Its a patch to a patch.  I got the origial patch from 1028364C_DM37x_Linux_Mainstream_UG.zip (which contains the patches/0001-Create-LPD-4.9.y-BSP.patch) file.

    Marco Fonseca
    New Member
    New Member
    Posts:15


    --
    30 May 2018 11:52 AM

    Rather,  a patch to a file generated from the patch.



    ---