[Gluster-devel] New Defects reported by Coverity Scan for gluster/glusterfs

Vijay Bellur vbellur at redhat.com
Fri Apr 10 10:28:09 UTC 2015


New defects are related to the recently merged bitrot & tiering 
features. Can somebody help clean these up?

Thanks,
Vijay


On 04/09/2015 03:49 PM, scan-admin at coverity.com wrote:
>
> Hi,
>
> Please find the latest report on new defect(s) introduced to gluster/glusterfs found with Coverity Scan.
>
> 5 new defect(s) introduced to gluster/glusterfs found with Coverity Scan.
> 33 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
>
> New defect(s) Reported-by: Coverity Scan
> Showing 5 of 5 defect(s)
>
>
> ** CID 1293504:    (CHECKED_RETURN)
> /xlators/mgmt/glusterd/src/glusterd-volgen.c: 3333 in volume_volgen_graph_build_clusters_tier()
> /xlators/mgmt/glusterd/src/glusterd-volgen.c: 3334 in volume_volgen_graph_build_clusters_tier()
>
>
> ________________________________________________________________________________________________________
> *** CID 1293504:    (CHECKED_RETURN)
> /xlators/mgmt/glusterd/src/glusterd-volgen.c: 3333 in volume_volgen_graph_build_clusters_tier()
> 3327             hxl = first_of(graph);
> 3328
> 3329             volinfo->type           = GF_CLUSTER_TYPE_TIER;
> 3330             xl = volgen_graph_add_nolink (graph, "cluster/tier", "%s",
> 3331                                           "tier-dht", 0);
> 3332             gf_asprintf(&rule, "%s-hot-dht", st_volname);
>>>>      CID 1293504:    (CHECKED_RETURN)
>>>>      Calling "xlator_set_option" without checking return value (as is done elsewhere 75 out of 81 times).
> 3333             xlator_set_option(xl, "rule", rule);
> 3334             xlator_set_option(xl, "xattr-name", "trusted.tier-gfid");
> 3335
> 3336             ret = volgen_xlator_link (xl, cxl);
> 3337             ret = volgen_xlator_link (xl, hxl);
> 3338
> /xlators/mgmt/glusterd/src/glusterd-volgen.c: 3334 in volume_volgen_graph_build_clusters_tier()
> 3328
> 3329             volinfo->type           = GF_CLUSTER_TYPE_TIER;
> 3330             xl = volgen_graph_add_nolink (graph, "cluster/tier", "%s",
> 3331                                           "tier-dht", 0);
> 3332             gf_asprintf(&rule, "%s-hot-dht", st_volname);
> 3333             xlator_set_option(xl, "rule", rule);
>>>>      CID 1293504:    (CHECKED_RETURN)
>>>>      Calling "xlator_set_option" without checking return value (as is done elsewhere 75 out of 81 times).
> 3334             xlator_set_option(xl, "xattr-name", "trusted.tier-gfid");
> 3335
> 3336             ret = volgen_xlator_link (xl, cxl);
> 3337             ret = volgen_xlator_link (xl, hxl);
> 3338
> 3339             st_type = GF_CLUSTER_TYPE_TIER;
>
> ** CID 1293503:  Null pointer dereferences  (FORWARD_NULL)
> /xlators/storage/posix/src/posix.c: 4137 in posix_fgetxattr()
>
>
> ________________________________________________________________________________________________________
> *** CID 1293503:  Null pointer dereferences  (FORWARD_NULL)
> /xlators/storage/posix/src/posix.c: 4137 in posix_fgetxattr()
> 4131                             gf_log (this->name, GF_LOG_WARNING,
> 4132                                     "Failed to set dictionary value for %s",
> 4133                                     name);
> 4134                     goto done;
> 4135             }
> 4136
>>>>      CID 1293503:  Null pointer dereferences  (FORWARD_NULL)
>>>>      Passing null pointer "name" to "strncmp", which dereferences it.
> 4137             if (strncmp (name, GLUSTERFS_GET_OBJECT_SIGNATURE,
> 4138                           strlen (GLUSTERFS_GET_OBJECT_SIGNATURE)) == 0) {
> 4139                     op_ret = posix_fdget_objectsignature (_fd, dict);
> 4140                     if (op_ret < 0) {
> 4141                             op_errno = -op_ret;
> 4142                             op_ret = -1;
>
> ** CID 1293502:  Null pointer dereferences  (NULL_RETURNS)
> /xlators/mgmt/glusterd/src/glusterd-volgen.c: 3330 in volume_volgen_graph_build_clusters_tier()
>
>
> ________________________________________________________________________________________________________
> *** CID 1293502:  Null pointer dereferences  (NULL_RETURNS)
> /xlators/mgmt/glusterd/src/glusterd-volgen.c: 3330 in volume_volgen_graph_build_clusters_tier()
> 3324             if (ret == -1)
> 3325                     goto out;
> 3326
> 3327             hxl = first_of(graph);
> 3328
> 3329             volinfo->type           = GF_CLUSTER_TYPE_TIER;
>>>>      CID 1293502:  Null pointer dereferences  (NULL_RETURNS)
>>>>      Assigning: "xl" = null return value from "volgen_graph_add_nolink".
> 3330             xl = volgen_graph_add_nolink (graph, "cluster/tier", "%s",
> 3331                                           "tier-dht", 0);
> 3332             gf_asprintf(&rule, "%s-hot-dht", st_volname);
> 3333             xlator_set_option(xl, "rule", rule);
> 3334             xlator_set_option(xl, "xattr-name", "trusted.tier-gfid");
> 3335
>
> ** CID 1293501:  Null pointer dereferences  (REVERSE_INULL)
> /xlators/storage/posix/src/posix.c: 4148 in posix_fgetxattr()
>
>
> ________________________________________________________________________________________________________
> *** CID 1293501:  Null pointer dereferences  (REVERSE_INULL)
> /xlators/storage/posix/src/posix.c: 4148 in posix_fgetxattr()
> 4142                             op_ret = -1;
> 4143                     }
> 4144
> 4145                     goto done;
> 4146             }
> 4147
>>>>      CID 1293501:  Null pointer dereferences  (REVERSE_INULL)
>>>>      Null-checking "name" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
> 4148             if (name) {
> 4149                     strcpy (key, name);
> 4150     #ifdef GF_DARWIN_HOST_OS
> 4151                     struct posix_private *priv       = NULL;
> 4152                     priv = this->private;
> 4153                     if (priv->xattr_user_namespace == XATTR_STRIP) {
>
> ** CID 1293500:  Code maintainability issues  (UNUSED_VALUE)
> /xlators/mgmt/glusterd/src/glusterd-brick-ops.c: 469 in __glusterd_handle_add_brick()
>
>
> ________________________________________________________________________________________________________
> *** CID 1293500:  Code maintainability issues  (UNUSED_VALUE)
> /xlators/mgmt/glusterd/src/glusterd-brick-ops.c: 469 in __glusterd_handle_add_brick()
> 463                                       "Volume %s is already a tier.", volname);
> 464                             gf_log (this->name, GF_LOG_ERROR, "%s", err_str);
> 465                             ret = -1;
> 466                             goto out;
> 467                     }
> 468
>>>>      CID 1293500:  Code maintainability issues  (UNUSED_VALUE)
>>>>      Assigning value from "dict_get_int32(dict, "type", &type)" to "ret" here, but that stored value is overwritten before it can be used.
> 469                     ret = dict_get_int32 (dict, "type", &type);
> 470
> 471                     goto brick_val;
> 472             }
> 473
> 474             if (!stripe_count && !replica_count) {
>
>
> ________________________________________________________________________________________________________
> To view the defects in Coverity Scan visit, https://scan.coverity.com/projects/987?tab=overview
>
> To manage Coverity Scan email notifications for "gluster-devel at gluster.org", click https://scan.coverity.com/subscriptions/edit?email=gluster-devel%40gluster.org&token=7dffab14bc5a7180e75b0d047539f148 .
>
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at gluster.org
> http://www.gluster.org/mailman/listinfo/gluster-devel
>
>



More information about the Gluster-devel mailing list