summaryrefslogtreecommitdiffstats
path: root/net/caif/cfdgml.c
diff options
context:
space:
mode:
authorswkhack <swkhack@gmail.com>2019-05-17 15:59:22 +0800
committerDavid S. Miller <davem@davemloft.net>2019-05-17 11:31:15 -0700
commit34dcf6a1902ac214149a2742250ff03aa5346f3e (patch)
treed0d0b9aedcb5e2cc02f627b2e1b909befd29a1e2 /net/caif/cfdgml.c
parent510e2ceda031eed97a7a0f9aad65d271a58b460d (diff)
downloadlinux-34dcf6a1902ac214149a2742250ff03aa5346f3e.tar.bz2
net: caif: fix the value of size argument of snprintf
Because the function snprintf write at most size bytes(including the null byte).So the value of the argument size need not to minus one. Signed-off-by: swkhack <swkhack@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif/cfdgml.c')
-rw-r--r--net/caif/cfdgml.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/caif/cfdgml.c b/net/caif/cfdgml.c
index 3bdddb32d55a..58fdb99a390f 100644
--- a/net/caif/cfdgml.c
+++ b/net/caif/cfdgml.c
@@ -33,8 +33,7 @@ struct cflayer *cfdgml_create(u8 channel_id, struct dev_info *dev_info)
cfsrvl_init(dgm, channel_id, dev_info, true);
dgm->layer.receive = cfdgml_receive;
dgm->layer.transmit = cfdgml_transmit;
- snprintf(dgm->layer.name, CAIF_LAYER_NAME_SZ - 1, "dgm%d", channel_id);
- dgm->layer.name[CAIF_LAYER_NAME_SZ - 1] = '\0';
+ snprintf(dgm->layer.name, CAIF_LAYER_NAME_SZ, "dgm%d", channel_id);
return &dgm->layer;
}