Re: [PATCH] tools/csr_usb: Fix compilation failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bastien,

> GCC's "format-nonliteral" security check is enabled as an error in
> recent versions of Fedora. Given the reduced scope of use, mark the
> error as ignorable through pragma.
> 
> tools/csr_usb.c: In function 'read_value':
> tools/csr_usb.c:82:2: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
>  n = fscanf(file, format, &value);
>  ^
> ---
> tools/csr_usb.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/tools/csr_usb.c b/tools/csr_usb.c
> index a1d7324f7..33e9968a2 100644
> --- a/tools/csr_usb.c
> +++ b/tools/csr_usb.c
> @@ -67,6 +67,8 @@ struct usbfs_bulktransfer {
> #define USBFS_IOCTL_CLAIMINTF	_IOR('U', 15, unsigned int)
> #define USBFS_IOCTL_RELEASEINTF	_IOR('U', 16, unsigned int)
> 
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wformat-nonliteral"
> static int read_value(const char *name, const char *attr, const char *format)
> {
> 	char path[PATH_MAX];
> @@ -88,6 +90,7 @@ static int read_value(const char *name, const char *attr, const char *format)
> 	fclose(file);
> 	return value;
> }
> +#pragma GCC diagnostic pop

can’t we just use __attribute__((format)) somehow to declare this a format specify?

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux