> -----Original Message----- > From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb- > owner@xxxxxxxxxxxxxxx] On Behalf Of philippedeswert@xxxxxxxxx > Sent: Saturday, May 24, 2014 7:29 PM > To: philippedeswert@xxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx > Subject: [PATCH v3 4/4] libusbg: Do not dereference usb config > attributes when they are NULL. CID#56126 > > From: Philippe De Swert <philippe.deswert@xxxxxxxxxxxxxxx> > > 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> Reviewed-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx> > --- > 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 -- 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