alpine 3.9
obsolete weakness #538

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

dahdi-tools/src/dahdi-tools-2.11.1/xpp/xtalk/xusb_libusb.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.9 obsolete weakness.

 	if (ret < 0) {
		/*
		 * If the device was gone, it may be the
		 * result of renumeration. Ignore it.
		 */
		if (ret != -ENODEV) {
			XUSB_ERR(iface, "write to endpoint 0x%x failed: (%d) %s\n",
				ep_out, ret, usb_strerror());
			dump_packet(LOG_ERR, DBG_MASK, "xusb_send[ERR]",
				buf, len);
			/*exit(2);*/
		} else {
			XUSB_DBG(iface, "write to endpoint 0x%x got ENODEV\n",
				ep_out);
			xusb_close(xusb_device);
		}
		return ret;
	}
	if (!ret) {

		XUSB_ERR(iface, "write to endpoint 0x%x short write[%d]: (%d)\n",
			ep_out, retries, ret);
		if (retries++ > MAX_RETRIES)
			return -EFAULT;
		usleep(100);
		goto retry_write;
	}
	if (ret != len) {
		XUSB_ERR(iface, "write to endpoint 0x%x short write: (%d) %s\n",
			ep_out, ret, usb_strerror());
		dump_packet(LOG_ERR, DBG_MASK, "xusb_send[ERR]", buf, len);
		return -EFAULT;
	}
	return ret;
}

int xusb_recv(struct xusb_iface *iface, char *buf, size_t len, int timeout)
{
	struct xusb_device *xusb_device = iface->xusb_device;
	int ep_in = EP_IN(iface);
	int retries = 0;
	int ret;

	if (!xusb_device->impl->handle) {
		XUSB_ERR(iface, "device closed\n");
		return -ENXIO;
	}
	if (!EP_IS_IN(ep_in)) {
		XUSB_ERR(iface, "called with an output endpoint 0x%x\n", ep_in);
		return -EINVAL; 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.