From 82d197462f703b1907535b9d98dffad746cec298 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 10 Jul 2017 15:32:49 +1000 Subject: [PATCH] hidpp20: fix NULL-pointer dereference warning rc may be a negative errno or a positive hidpp error code. If the latter we used to continue with a NULL macro pointer, eventually crashing. Signed-off-by: Peter Hutterer --- src/hidpp20.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hidpp20.c b/src/hidpp20.c index 0855a781..e99d219e 100644 --- a/src/hidpp20.c +++ b/src/hidpp20.c @@ -1552,7 +1552,7 @@ hidpp20_onboard_profiles_parse_macro(struct hidpp20_device *device, int rc; rc = hidpp20_onboard_profiles_read_macro(device, page, offset, ¯o); - if (rc < 0) + if (rc) return rc; count = rc;