diff mbox series

[ndctl,3/5] util/json: fix an error check for region resource

Message ID 20181002033140.21295-3-vishal.l.verma@intel.com (mailing list archive)
State New, archived
Headers show
Series [ndctl,1/5] ndctl, lib: refactor badblocks retrieval routines | expand

Commit Message

Vishal Verma Oct. 2, 2018, 3:31 a.m. UTC
The return type of ndctl_region_get_resource() is 'unsigned long long',
and therefore the error checking for it should be done against
ULLONG_MAX. Fix an instance where we were checking against ULONG_MAX.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 util/json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Williams Oct. 3, 2018, 1:47 a.m. UTC | #1
On Mon, Oct 1, 2018 at 8:38 PM Vishal Verma <vishal.l.verma@intel.com> wrote:
>
> The return type of ndctl_region_get_resource() is 'unsigned long long',
> and therefore the error checking for it should be done against
> ULLONG_MAX. Fix an instance where we were checking against ULONG_MAX.
>

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
diff mbox series

Patch

diff --git a/util/json.c b/util/json.c
index 2d15859..30b56c3 100644
--- a/util/json.c
+++ b/util/json.c
@@ -470,7 +470,7 @@  struct json_object *util_region_badblocks_to_json(struct ndctl_region *region,
 
 		/* get start address of region */
 		addr = ndctl_region_get_resource(region);
-		if (addr == ULONG_MAX)
+		if (addr == ULLONG_MAX)
 			goto err_array;
 
 		/* get address of bad block */