[PATCH 10/10] raw/cnxk_gpio: support selftest

Stephen Hemminger stephen at networkplumber.org
Wed Nov 17 02:17:37 CET 2021


On Wed, 17 Nov 2021 01:21:55 +0100
Tomasz Duszynski <tduszynski at marvell.com> wrote:

> +static int
> +cnxk_gpio_open_mem(void)
> +{
> +	int ret = 0, fd;
> +
> +	fd = open("/dev/mem", O_RDWR | O_SYNC);
> +	if (fd < 0)
> +		ret = -errno;
> +
> +	return ret;
> +}

This is a dangerous security violation and most distributions
will not allow it.

Also, why are you opening it? The code is forgetting the file
descriptor so it is useless anyway.


More information about the dev mailing list