We probably need to check if we get valid attributes passed. Otherwise we will try to dereference a NULL-pointer as the usb_config_attr will not be valid. Signed-off-by: Philippe De Swert <philippe.deswert@xxxxxxxxxxxxxxx> --- src/usbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/usbg.c b/src/usbg.c index 8ad6a9e..f7bd7aa 100644 --- a/src/usbg.c +++ b/src/usbg.c @@ -1787,7 +1787,7 @@ int usbg_set_config_attrs(usbg_config *c, usbg_config_attrs *c_attrs) { int ret = USBG_ERROR_INVALID_PARAM; - if (c && !c_attrs) { + if (c && c_attrs) { ret = usbg_write_dec(c->path, c->name, "MaxPower", c_attrs->bMaxPower); if (ret == USBG_SUCCESS) ret = usbg_write_hex8(c->path, c->name, "bmAttributes", -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html