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

Incorrect use of PTR_ERR on valid pointers in out_handler.c

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 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

        Activity

          People

            wc-triage WC Triage
            green Oleg Drokin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: