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

Fix Coverity issues introduced by "LU-14288 nodemap: Use nidmasks for IPv6 NIDs"

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.17.0
    • Lustre 2.17.0
    • 3
    • 9223372036854775807

    Description

      ________________________________________________________________________________________________________
      *** CID 451797:  Null pointer dereferences  (NULL_RETURNS)
      /lustre/ptlrpc/nodemap_range.c: 115 in range_create()
      109     		snprintf(nidstr, sizeof(nidstr), "%s",
      110     			 libcfs_nidstr(start_nid));
      111     
      112     		c = strchr(nidstr, '@');
      113     
      114     		/* net = @<net> */
         CID 451797:  Null pointer dereferences  (NULL_RETURNS)
         Dereferencing a pointer that might be "NULL" "c" when calling "strscpy".
      115     		strscpy(net, c, sizeof(net));
      116     
      117     		*c = '\0';
      118     
      119     		/* nidstr = <addr>/<prefix_length> */
      120     		snprintf(c, sizeof(nidstr) - strlen(nidstr), "/%u", netmask);
      
      ________________________________________________________________________________________________________
      *** CID 451795:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
      /lustre/ptlrpc/nodemap_range.c: 96 in range_create()
      90     		/* +4 for '/<prefix_length>' */
      91     		char nidstr[LNET_NIDSTR_SIZE + 4];
      92     		char net[LNET_NIDSTR_SIZE];
      93     		char *c;
      94     		int rc;
      95     
         CID 451795:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
         "netmask > 999" is always false regardless of the values of its operands. This occurs as the logical operand of "if".
      96     		if (netmask > 999) {
      97     			/* If the netmask is somehow more than three characters
      98     			 * then the logic below could truncate it which could
      99     			 * result in creating a valid netmask value from bad
      100     			 * input.
      101     			 * cfs_parse_nidlist() will check whether the netmask
      

      Attachments

        Activity

          People

            sebastien Sebastien Buisson
            sebastien Sebastien Buisson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: