From: Dan Carpenter <dan.carpenter@oracle.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [bug report] gfs2: dump fsid when dumping glock problems
Date: Fri, 9 Aug 2019 16:13:23 +0300 [thread overview]
Message-ID: <20190809131323.GA11448@mwanda> (raw)
Hello Bob Peterson,
The patch 3792ce973f07: "gfs2: dump fsid when dumping glock problems"
from May 9, 2019, leads to the following static checker warning:
fs/gfs2/glock.c:1796 gfs2_dump_glock()
error: format string overflow. buf_size: 270 length: 277
fs/gfs2/glock.c
1785 void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl, bool fsid)
1786 {
1787 const struct gfs2_glock_operations *glops = gl->gl_ops;
1788 unsigned long long dtime;
1789 const struct gfs2_holder *gh;
1790 char gflags_buf[32];
1791 char fs_id_buf[GFS2_FSNAME_LEN + 3 * sizeof(int) + 2];
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is the same as sizeof(sdp->sd_fsname);
1792 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
1793
1794 memset(fs_id_buf, 0, sizeof(fs_id_buf));
1795 if (fsid && sdp) /* safety precaution */
1796 sprintf(fs_id_buf, "fsid=%s: ", sdp->sd_fsname);
^^^^^ ^^
So if sd_fsname is as large as "possible" we could be 7 characters over
the limit.
1797 dtime = jiffies - gl->gl_demote_time;
1798 dtime *= 1000000/HZ; /* demote time in uSec */
1799 if (!test_bit(GLF_DEMOTE, &gl->gl_flags))
1800 dtime = 0;
1801 gfs2_print_dbg(seq, "%sG: s:%s n:%u/%llx f:%s t:%s d:%s/%llu a:%d "
See also:
fs/gfs2/util.c:184 gfs2_consist_rgrpd_i() error: format string overflow. buf_size: 270 length: 277
fs/gfs2/rgrp.c:2293 gfs2_rgrp_error() error: format string overflow. buf_size: 270 length: 277
regards,
dan carpenter
reply other threads:[~2019-08-09 13:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190809131323.GA11448@mwanda \
--to=dan.carpenter@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.