Fix compile warnings
Gcc now warns about possible errors from passing a string buffer as format arguement to printf().
This commit is contained in:
parent
bdc213423a
commit
9a73e17deb
46
ip/ipxfrm.c
46
ip/ipxfrm.c
|
|
@ -283,7 +283,7 @@ void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
|
||||||
char abuf[256];
|
char abuf[256];
|
||||||
|
|
||||||
if (title)
|
if (title)
|
||||||
fprintf(fp, title);
|
fputs(title, fp);
|
||||||
|
|
||||||
memset(abuf, '\0', sizeof(abuf));
|
memset(abuf, '\0', sizeof(abuf));
|
||||||
fprintf(fp, "src %s ", rt_addr_n2a(family, sizeof(*saddr),
|
fprintf(fp, "src %s ", rt_addr_n2a(family, sizeof(*saddr),
|
||||||
|
|
@ -294,7 +294,7 @@ void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "%s", _SL_);
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "\t");
|
fprintf(fp, "\t");
|
||||||
|
|
||||||
fprintf(fp, "proto %s ", strxf_xfrmproto(id->proto));
|
fprintf(fp, "proto %s ", strxf_xfrmproto(id->proto));
|
||||||
|
|
@ -350,12 +350,12 @@ static const char *strxf_limit(__u64 limit)
|
||||||
void xfrm_stats_print(struct xfrm_stats *s, FILE *fp, const char *prefix)
|
void xfrm_stats_print(struct xfrm_stats *s, FILE *fp, const char *prefix)
|
||||||
{
|
{
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "stats:");
|
fprintf(fp, "stats:");
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "%s", _SL_);
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, " ");
|
fprintf(fp, " ");
|
||||||
fprintf(fp, "replay-window %u ", s->replay_window);
|
fprintf(fp, "replay-window %u ", s->replay_window);
|
||||||
fprintf(fp, "replay %u ", s->replay);
|
fprintf(fp, "replay %u ", s->replay);
|
||||||
|
|
@ -391,12 +391,12 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
|
||||||
{
|
{
|
||||||
if (cfg) {
|
if (cfg) {
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "lifetime config:");
|
fprintf(fp, "lifetime config:");
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "%s", _SL_);
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, " ");
|
fprintf(fp, " ");
|
||||||
fprintf(fp, "limit: ");
|
fprintf(fp, "limit: ");
|
||||||
fprintf(fp, "soft ");
|
fprintf(fp, "soft ");
|
||||||
|
|
@ -407,7 +407,7 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "%s", _SL_);
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, " ");
|
fprintf(fp, " ");
|
||||||
fprintf(fp, "limit: ");
|
fprintf(fp, "limit: ");
|
||||||
fprintf(fp, "soft ");
|
fprintf(fp, "soft ");
|
||||||
|
|
@ -418,7 +418,7 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "%s", _SL_);
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, " ");
|
fprintf(fp, " ");
|
||||||
fprintf(fp, "expire add: ");
|
fprintf(fp, "expire add: ");
|
||||||
fprintf(fp, "soft ");
|
fprintf(fp, "soft ");
|
||||||
|
|
@ -429,7 +429,7 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "%s", _SL_);
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, " ");
|
fprintf(fp, " ");
|
||||||
fprintf(fp, "expire use: ");
|
fprintf(fp, "expire use: ");
|
||||||
fprintf(fp, "soft ");
|
fprintf(fp, "soft ");
|
||||||
|
|
@ -441,19 +441,19 @@ void xfrm_lifetime_print(struct xfrm_lifetime_cfg *cfg,
|
||||||
}
|
}
|
||||||
if (cur) {
|
if (cur) {
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "lifetime current:");
|
fprintf(fp, "lifetime current:");
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "%s", _SL_);
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, " ");
|
fprintf(fp, " ");
|
||||||
fprintf(fp, "%llu(bytes), ", (unsigned long long) cur->bytes);
|
fprintf(fp, "%llu(bytes), ", (unsigned long long) cur->bytes);
|
||||||
fprintf(fp, "%llu(packets)", (unsigned long long) cur->packets);
|
fprintf(fp, "%llu(packets)", (unsigned long long) cur->packets);
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "%s", _SL_);
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, " ");
|
fprintf(fp, " ");
|
||||||
fprintf(fp, "add %s ", strxf_time(cur->add_time));
|
fprintf(fp, "add %s ", strxf_time(cur->add_time));
|
||||||
fprintf(fp, "use %s", strxf_time(cur->use_time));
|
fprintf(fp, "use %s", strxf_time(cur->use_time));
|
||||||
|
|
@ -474,7 +474,7 @@ void xfrm_selector_print(struct xfrm_selector *sel, __u16 family,
|
||||||
f = preferred_family;
|
f = preferred_family;
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
|
|
||||||
memset(abuf, '\0', sizeof(abuf));
|
memset(abuf, '\0', sizeof(abuf));
|
||||||
fprintf(fp, "src %s/%u ", rt_addr_n2a(f, sizeof(sel->saddr),
|
fprintf(fp, "src %s/%u ", rt_addr_n2a(f, sizeof(sel->saddr),
|
||||||
|
|
@ -533,7 +533,7 @@ static void __xfrm_algo_print(struct xfrm_algo *algo, int type, int len,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
|
|
||||||
fprintf(fp, "%s ", strxf_algotype(type));
|
fprintf(fp, "%s ", strxf_algotype(type));
|
||||||
|
|
||||||
|
|
@ -596,7 +596,7 @@ static void xfrm_tmpl_print(struct xfrm_user_tmpl *tmpls, int len,
|
||||||
|
|
||||||
if (ntmpls <= 0) {
|
if (ntmpls <= 0) {
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "(ERROR \"tmpl\" truncated)");
|
fprintf(fp, "(ERROR \"tmpl\" truncated)");
|
||||||
fprintf(fp, "%s", _SL_);
|
fprintf(fp, "%s", _SL_);
|
||||||
return;
|
return;
|
||||||
|
|
@ -606,14 +606,14 @@ static void xfrm_tmpl_print(struct xfrm_user_tmpl *tmpls, int len,
|
||||||
struct xfrm_user_tmpl *tmpl = &tmpls[i];
|
struct xfrm_user_tmpl *tmpl = &tmpls[i];
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
|
|
||||||
xfrm_id_info_print(&tmpl->saddr, &tmpl->id, tmpl->mode,
|
xfrm_id_info_print(&tmpl->saddr, &tmpl->id, tmpl->mode,
|
||||||
tmpl->reqid, family, 0, fp, prefix, "tmpl ");
|
tmpl->reqid, family, 0, fp, prefix, "tmpl ");
|
||||||
|
|
||||||
if (show_stats > 0 || tmpl->optional) {
|
if (show_stats > 0 || tmpl->optional) {
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "\t");
|
fprintf(fp, "\t");
|
||||||
switch (tmpl->optional) {
|
switch (tmpl->optional) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -636,7 +636,7 @@ static void xfrm_tmpl_print(struct xfrm_user_tmpl *tmpls, int len,
|
||||||
|
|
||||||
if (show_stats > 0) {
|
if (show_stats > 0) {
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "\t");
|
fprintf(fp, "\t");
|
||||||
fprintf(fp, "%s-mask %s ",
|
fprintf(fp, "%s-mask %s ",
|
||||||
strxf_algotype(XFRMA_ALG_CRYPT),
|
strxf_algotype(XFRMA_ALG_CRYPT),
|
||||||
|
|
@ -685,7 +685,7 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
|
||||||
char abuf[256];
|
char abuf[256];
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "encap ");
|
fprintf(fp, "encap ");
|
||||||
|
|
||||||
if (RTA_PAYLOAD(tb[XFRMA_ENCAP]) < sizeof(*e)) {
|
if (RTA_PAYLOAD(tb[XFRMA_ENCAP]) < sizeof(*e)) {
|
||||||
|
|
@ -728,7 +728,7 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
|
||||||
xfrm_address_t *coa;
|
xfrm_address_t *coa;
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "coa ");
|
fprintf(fp, "coa ");
|
||||||
|
|
||||||
coa = (xfrm_address_t *)RTA_DATA(tb[XFRMA_COADDR]);
|
coa = (xfrm_address_t *)RTA_DATA(tb[XFRMA_COADDR]);
|
||||||
|
|
@ -750,7 +750,7 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
|
||||||
__u64 lastused;
|
__u64 lastused;
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf(fp, prefix);
|
fputs(prefix, fp);
|
||||||
fprintf(fp, "lastused ");
|
fprintf(fp, "lastused ");
|
||||||
|
|
||||||
if (RTA_PAYLOAD(tb[XFRMA_LASTUSED]) < sizeof(lastused)) {
|
if (RTA_PAYLOAD(tb[XFRMA_LASTUSED]) < sizeof(lastused)) {
|
||||||
|
|
@ -792,7 +792,7 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo,
|
||||||
STRBUF_CAT(buf, prefix);
|
STRBUF_CAT(buf, prefix);
|
||||||
STRBUF_CAT(buf, "\t");
|
STRBUF_CAT(buf, "\t");
|
||||||
|
|
||||||
fprintf(fp, buf);
|
fputs(buf, fp);
|
||||||
fprintf(fp, "replay-window %u ", xsinfo->replay_window);
|
fprintf(fp, "replay-window %u ", xsinfo->replay_window);
|
||||||
if (show_stats > 0)
|
if (show_stats > 0)
|
||||||
fprintf(fp, "seq 0x%08u ", xsinfo->seq);
|
fprintf(fp, "seq 0x%08u ", xsinfo->seq);
|
||||||
|
|
@ -842,7 +842,7 @@ void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo,
|
||||||
STRBUF_CAT(buf, prefix);
|
STRBUF_CAT(buf, prefix);
|
||||||
STRBUF_CAT(buf, "\t");
|
STRBUF_CAT(buf, "\t");
|
||||||
|
|
||||||
fprintf(fp, buf);
|
fputs(buf, fp);
|
||||||
fprintf(fp, "dir ");
|
fprintf(fp, "dir ");
|
||||||
switch (xpinfo->dir) {
|
switch (xpinfo->dir) {
|
||||||
case XFRM_POLICY_IN:
|
case XFRM_POLICY_IN:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue