[PATCH v2 4/4] libusbg: Do not dereference usb config attributes when they are NULL. CID#56126

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux