lkml.org 
[lkml]   [2022]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRE: [EXT] Re: [PATCH] crypto: octeontx2: fix potential null pointer access
    Date
    >> diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
    >b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
    >> index 9cba2f714c7e..b91401929fc6 100644
    >> --- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
    >> +++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
    >> @@ -1605,7 +1605,11 @@ int otx2_cpt_dl_custom_egrp_create(struct
    >otx2_cptpf_dev *cptpf,
    >> if (!strncasecmp(val, "se", 2) && strchr(val, ':')) {
    >> if (has_se || ucode_idx)
    >> goto err_print;
    >> - tmp = strim(strsep(&val, ":"));
    >> + tmp = strsep(&val, ":");
    >> + if (tmp != NULL)
    >> + tmp = strim(tmp);
    >> + else
    >> + goto err_print;
    >
    >The check is not needed here, but if it were then the better way to
    >write this would be:
    >
    > tmp = strsep(&val, ":");
    > if (!tmp)
    > goto err_print;
    > tmp = strim(tmp);
    >
    >Always to error handling, not success handling. checkpatch.pl --strict
    >will complain about the != NULL.
    >

    Will change the check as mentioned.

    Thanks,
    Shijith

    \
     
     \ /
      Last update: 2022-05-27 11:50    [W:4.383 / U:0.216 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site