Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-3023

Fix fuzzy logic in get_root_path()

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Minor
    • Lustre 2.4.0
    • Lustre 2.4.0
    • 7360

    Description

      While analyzing the Lustre code with Coverity, we found an incorrect logic in the get_root_path() function.

      Here is Andreas' comment from http://review.whamcloud.com/#patch,sidebyside,5271,5,lustre/utils/liblustreapi.c:
      "In that case, why have the "if (!ptr" check above? Probably Coverity is confused that ptr is checked against NULL above, but can fall through in the "len != 0" case and dereference the NULL ptr.

      I suspect the reader and coverity would be happier if there was "LASSERT(ptr != NULL)" after strrchr(), though definitely your comment clearly explains why this LASSERT() would be true, and it should be kept.

      Code style says this should have been "if (ptr == NULL && len == 0)". This makes me wonder about the above check as well. Why should the scanning be aborted if (len == 0) (i.e. no other mountpoint is found)? Since IMHO it should just continue on, and ptr is never NULL, I think the above check and -EINVAL could just be removed, perhaps in a separate patch."

      I will propose a patch to address remark from Andreas.

      Attachments

        Activity

          People

            jamesanunez James Nunez (Inactive)
            sebastien.buisson Sebastien Buisson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: