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

Incorrect use of PTR_ERR on valid pointers in out_handler.c

Details

    • Bug
    • Resolution: Fixed
    • Major
    • Lustre 2.17.0
    • Lustre 2.12.0
    • 3
    • 9223372036854775807

    Description

      It looks like there's a lot of incorrect code like this:

              tmp = object_update_param_get(update, 1, &size);
              if (IS_ERR(tmp) || size != sizeof(*tmp)) {
                      CERROR("%s: empty or wrong size %zu pos: rc = %ld\n",
                             tgt_name(tsi->tsi_tgt), size, PTR_ERR(tmp));
                      RETURN(PTR_ERR(tmp));
              }
      

      so it's clear when IS_ERR is true all is fine, but when sizeof does not match - the pointer is likely valid so some different handling needs to be made?

      here's the total list of all offenders:
      lustre/target/out_handler.c:120 out_create() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:122 out_create() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:134 out_create() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:136 out_create() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:173 out_attr_set() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:175 out_attr_set() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:442 out_xattr_set() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:444 out_xattr_set() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:539 out_index_insert() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:541 out_index_insert() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:555 out_index_insert() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:557 out_index_insert() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:642 out_write() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:644 out_write() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:651 out_write() warn: passing a valid pointer to 'PTR_ERR'
      lustre/target/out_handler.c:653 out_write() warn: passing a valid pointer to 'PTR_ERR'

      Attachments

        Issue Links

          Activity

            [LU-11610] Incorrect use of PTR_ERR on valid pointers in out_handler.c
            pjones Peter Jones added a comment -

            Merged for 2.17

            pjones Peter Jones added a comment - Merged for 2.17

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/56260/
            Subject: LU-11610 target: Fix correct return value in out_handler.c
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 371c0c1aef0acd46ba7c16cf4f2e05a21ae48fdf

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/56260/ Subject: LU-11610 target: Fix correct return value in out_handler.c Project: fs/lustre-release Branch: master Current Patch Set: Commit: 371c0c1aef0acd46ba7c16cf4f2e05a21ae48fdf

            "Ronnie Sahlberg <rsahlberg@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/56260
            Subject: LU-11610 target: Fix correct return value in out_handler.c
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: a10567a49af11e348fbb5c23c072710e89ebd4e9

            gerrit Gerrit Updater added a comment - "Ronnie Sahlberg <rsahlberg@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/56260 Subject: LU-11610 target: Fix correct return value in out_handler.c Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: a10567a49af11e348fbb5c23c072710e89ebd4e9

            still an issue

            adilger Andreas Dilger added a comment - still an issue

            People

              rsahlberg@whamcloud.com Ronnie Sahlberg
              green Oleg Drokin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: