On Wed, Jun 06, 2018 at 06:07:36AM +0000, Bart Van Assche wrote: > On Fri, 2018-05-25 at 15:20 -0600, Jason Gunthorpe wrote: > > The latest gcc in tumbleweed reports: > > > > ../srp_daemon/srp_daemon.c: In function 'get_shared_pkeys': > > ../srp_daemon/srp_daemon.c:1080:50: warning: '__builtin___snprintf_chk' output may be truncated before the last format character [-Wformat-truncation=] > > snprintf(pkey_file, sizeof(pkey_file), "pkeys/%d", pkey_index); > > > > The given format string requires 18 bytes to handle all expansions of %d > > > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx> > > srp_daemon/srp_daemon.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c > > index fa452b4c537e9f..f3af6517499e71 100644 > > +++ b/srp_daemon/srp_daemon.c > > @@ -1074,7 +1074,7 @@ static int get_port_info(struct umad_resources *umad_res, uint16_t dlid, > > int pkey_index_to_pkey(struct umad_resources *umad_res, int pkey_index, > > uint16_t *pkey) > > { > > - char pkey_file[16], pkey_str[16]; > > + char pkey_file[18], pkey_str[16]; > > > > /* Read pkey */ > > snprintf(pkey_file, sizeof(pkey_file), "pkeys/%d", pkey_index); > > Hello Jason, > > Had you considered to change the data type of pkey_index from int into uint16_t > to suppress this warning? That would work too, but this is already committed. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html