use sizeof to determine size of memory to copy instead of using hard coded values. Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx> --- src/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gadget.c b/src/gadget.c index cba309d..ed6aef2 100644 --- a/src/gadget.c +++ b/src/gadget.c @@ -862,7 +862,7 @@ void gadget_set_net_dev_addr(struct function *f, struct ether_addr *dev_addr) { char *str_addr; - memcpy(&f->attr.net.dev_addr, dev_addr, 6); + memcpy(&f->attr.net.dev_addr, dev_addr, sizeof(*dev_addr)); str_addr = ether_ntoa(dev_addr); gadget_write_string(f->path, f->name, "dev_addr", str_addr); @@ -872,7 +872,7 @@ void gadget_set_net_host_addr(struct function *f, struct ether_addr *host_addr) { char *str_addr; - memcpy(&f->attr.net.host_addr, host_addr, 6); + memcpy(&f->attr.net.host_addr, host_addr, sizeof(*host_addr)); str_addr = ether_ntoa(host_addr); gadget_write_string(f->path, f->name, "host_addr", str_addr); -- 1.7.9.5 -- 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