diff mbox series

[v2] Fix FTBFS with -Werror=format-overflow

Message ID 20180131124855.20297-1-frediz@linux.vnet.ibm.com
State Accepted
Headers show
Series [v2] Fix FTBFS with -Werror=format-overflow | expand

Commit Message

Frédéric Bonnard Jan. 31, 2018, 12:48 p.m. UTC
i2c.c fails to compile with gcc7 and -Werror=format-overflow used in
Debian Unstable and Ubuntu 18.04 :

i2c.c: In function ‘i2c_init’:
i2c.c:211:15: error: ‘%s’ directive writing up to 255 bytes into a
region of size 236 [-Werror=format-overflow=]

dpath is supposed to store an entire path.

Signed-off-by: Frédéric Bonnard <frediz@linux.vnet.ibm.com>
---
 external/opal-prd/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Donnellan Jan. 31, 2018, 1:42 p.m. UTC | #1
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

On 31/01/18 23:48, Frédéric Bonnard wrote:
> i2c.c fails to compile with gcc7 and -Werror=format-overflow used in
> Debian Unstable and Ubuntu 18.04 :
> 
> i2c.c: In function ‘i2c_init’:
> i2c.c:211:15: error: ‘%s’ directive writing up to 255 bytes into a
> region of size 236 [-Werror=format-overflow=]
> 
> dpath is supposed to store an entire path.
> 
> Signed-off-by: Frédéric Bonnard <frediz@linux.vnet.ibm.com>
> ---
>   external/opal-prd/i2c.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/external/opal-prd/i2c.c b/external/opal-prd/i2c.c
> index ba4b3c85..0c9947c1 100644
> --- a/external/opal-prd/i2c.c
> +++ b/external/opal-prd/i2c.c
> @@ -211,7 +211,7 @@ void i2c_init(void)
>   #define SYSFS	"/sys"	/* XXX Find it ? */
>   	DIR *devsdir;
>   	struct dirent *devent;
> -	char dpath[NAME_MAX];
> +	char dpath[PATH_MAX];
>   	char busname[256];
>   	char *s;
>   	FILE *f;
>
Stewart Smith Feb. 9, 2018, 5:12 a.m. UTC | #2
Frédéric Bonnard <frediz@linux.vnet.ibm.com> writes:
> i2c.c fails to compile with gcc7 and -Werror=format-overflow used in
> Debian Unstable and Ubuntu 18.04 :
>
> i2c.c: In function ‘i2c_init’:
> i2c.c:211:15: error: ‘%s’ directive writing up to 255 bytes into a
> region of size 236 [-Werror=format-overflow=]
>
> dpath is supposed to store an entire path.
>
> Signed-off-by: Frédéric Bonnard <frediz@linux.vnet.ibm.com>
> ---
>  external/opal-prd/i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks! Merged to master as of b3e14c46ecb069b3076ca052e7180048dd863e5c
diff mbox series

Patch

diff --git a/external/opal-prd/i2c.c b/external/opal-prd/i2c.c
index ba4b3c85..0c9947c1 100644
--- a/external/opal-prd/i2c.c
+++ b/external/opal-prd/i2c.c
@@ -211,7 +211,7 @@  void i2c_init(void)
 #define SYSFS	"/sys"	/* XXX Find it ? */
 	DIR *devsdir;
 	struct dirent *devent;
-	char dpath[NAME_MAX];
+	char dpath[PATH_MAX];
 	char busname[256];
 	char *s;
 	FILE *f;