alpine 3.6
obsolete weakness #90

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:

v4l-utils/src/v4l-utils-1.12.5/utils/v4l2-dbg/v4l2-dbg.cpp

Context:

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

 		if ((i & mask) == 0 && line % 32 == 0) {
			if (stride == 4)
				printf("\n                00       04       08       0C       10       14       18       1C");
			else if (stride == 2)
				printf("\n            00   02   04   06   08   0A   0C   0E");
			else
				printf("\n          00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
		}

		if ((i & mask) == 0) {
			printf("\n%08lx: ", i);
			line++;
		}
		if (i < min) {
			printf("%*s ", 2 * stride, "");
			continue;
		}
		reg->reg = i;
		if (ioctl(fd, VIDIOC_DBG_G_REGISTER, reg) < 0) {
			perror("ioctl: VIDIOC_DBG_G_REGISTER failed\n");
			break;
		} else {
			printf("%0*llx ", 2 * stride, reg->val);
		}
		usleep(1);
	}
	printf("\n");
}

static void print_name(struct v4l2_dbg_chip_info *chip)
{
	printf("%-10s (%c%c)\n", chip->name,
		(chip->flags & V4L2_CHIP_FL_READABLE) ? 'r' : '-',
		(chip->flags & V4L2_CHIP_FL_WRITABLE) ? 'w' : '-');
}

static unsigned long long parse_reg(const struct board_list *curr_bd, const std::string &reg)
{
	if (curr_bd) {
		for (int i = 0; i < curr_bd->regs_size; i++) {
			if (!strcasecmp(reg.c_str(), curr_bd->regs[i].name) ||
			    !strcasecmp(reg.c_str(), curr_bd->regs[i].name + curr_bd->prefix)) {
				return curr_bd->regs[i].reg;
			}
		}
		for (int i = 0; i < curr_bd->alt_regs_size; i++) {
			if (!strcasecmp(reg.c_str(), curr_bd->alt_regs[i].name) ||
			    !strcasecmp(reg.c_str(), curr_bd->alt_regs[i].name + curr_bd->prefix)) {
				return curr_bd->alt_regs[i].reg;
			} 

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.