| 1 |
From: Roland Fehrenbacher <[email protected]> |
| 2 |
Date: Thu, 28 Dec 2017 19:56:31 +0100 |
| 3 |
Subject: Fix truncation warnings with gcc7 |
| 4 |
MIME-Version: 1.0 |
| 5 |
Content-Type: text/plain; charset="utf-8" |
| 6 |
Content-Transfer-Encoding: 8bit |
| 7 |
|
| 8 |
This patch was originally created by |
| 9 |
Johannes Brandstätter <[email protected]> see |
| 10 |
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853451 |
| 11 |
--- |
| 12 |
psm_ep.c | 6 +++--- |
| 13 |
1 file changed, 3 insertions(+), 3 deletions(-) |
| 14 |
|
| 15 |
diff --git a/psm_ep.c b/psm_ep.c |
| 16 |
index 6857895..2bd0ed4 100644 |
| 17 |
--- a/psm_ep.c |
| 18 |
+++ b/psm_ep.c |
| 19 |
@@ -978,7 +978,7 @@ __psm_ep_open(psm_uuid_t const unique_job_key, struct psm_ep_open_opts const *op |
| 20 |
int i, num_rails = 0; |
| 21 |
char *uname = "IPATH_UNIT"; |
| 22 |
char *pname = "IPATH_PORT"; |
| 23 |
- char uvalue[4], pvalue[4]; |
| 24 |
+ char uvalue[4], pvalue[6]; |
| 25 |
int devid_enabled[PTL_MAX_INIT]; |
| 26 |
union psmi_envvar_val devs; |
| 27 |
|
| 28 |
@@ -1010,7 +1010,7 @@ __psm_ep_open(psm_uuid_t const unique_job_key, struct psm_ep_open_opts const *op |
| 29 |
/* If multi-rail is used, set the first ep unit/port */ |
| 30 |
if (num_rails > 0) { |
| 31 |
snprintf(uvalue, 4, "%1d", units[0]); |
| 32 |
- snprintf(pvalue, 4, "%1d", ports[0]); |
| 33 |
+ snprintf(pvalue, 6, "%1d", ports[0]); |
| 34 |
setenv(uname, uvalue, 1); |
| 35 |
setenv(pname, pvalue, 1); |
| 36 |
} |
| 37 |
@@ -1038,7 +1038,7 @@ __psm_ep_open(psm_uuid_t const unique_job_key, struct psm_ep_open_opts const *op |
| 38 |
if (psmi_device_is_enabled(devid_enabled, PTL_DEVID_IPS)) { |
| 39 |
for (i = 1; i < num_rails; i++) { |
| 40 |
snprintf(uvalue, 4, "%1d", units[i]); |
| 41 |
- snprintf(pvalue, 4, "%1d", ports[i]); |
| 42 |
+ snprintf(pvalue, 6, "%1d", ports[i]); |
| 43 |
setenv(uname, uvalue, 1); |
| 44 |
setenv(pname, pvalue, 1); |
| 45 |
|