From 04990e4ea29f0a188acf8d84e7b1e32c111d0532 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 10 Jul 2017 15:37:11 +1000 Subject: [PATCH] hidpp10: error out if we deal with unsupported profiles Just logging and error and continuing is not enough, we'll eventually dereference garbage values. Signed-off-by: Peter Hutterer --- src/hidpp10.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hidpp10.c b/src/hidpp10.c index 0ffc4463..8fb8ba0c 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -1691,6 +1691,7 @@ hidpp10_set_profile(struct hidpp10_device *dev, int8_t number, struct hidpp10_pr break; default: hidpp_log_error(&dev->base, "This should never happen, complain to your maintainer.\n"); + return -ENOTSUP; } @@ -1711,6 +1712,7 @@ hidpp10_set_profile(struct hidpp10_device *dev, int8_t number, struct hidpp10_pr break; default: hidpp_log_error(&dev->base, "This should never happen, complain to your maintainer.\n"); + return -ENOTSUP; } switch (dev->profile_type) { @@ -1747,6 +1749,7 @@ hidpp10_set_profile(struct hidpp10_device *dev, int8_t number, struct hidpp10_pr break; default: hidpp_log_error(&dev->base, "This should never happen, complain to your maintainer.\n"); + return -ENOTSUP; } crc = hidpp_crc_ccitt(page_data, HIDPP10_PAGE_SIZE - 2);