From: Dan Carpenter <dan.carpenter@oracle.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [bug report] staging: lustre: llite: remove duplicate fiemap defines
Date: Thu, 20 Oct 2016 15:19:09 +0300 [thread overview]
Message-ID: <20161020121908.GA16578@elgon.mountain> (raw)
Hello Bobi Jam,
The patch cbd4d4a8e319: "staging: lustre: llite: remove duplicate
fiemap defines" from Oct 2, 2016, leads to the following static
checker warning:
drivers/staging/lustre/lustre/lov/lov_object.c:1241 lov_object_fiemap()
warn: signed overflow undefined. 'fm_start + fm_length < fm_start'
drivers/staging/lustre/lustre/lov/lov_object.c
1102 static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj,
1103 struct ll_fiemap_info_key *fmkey,
1104 struct fiemap *fiemap, size_t *buflen)
1105 {
1106 struct lov_obd *lov = lu2lov_dev(obj->co_lu.lo_dev)->ld_lov;
1107 unsigned int buffer_size = FIEMAP_BUFFER_SIZE;
1108 struct fiemap_extent *lcl_fm_ext;
1109 struct cl_object *subobj = NULL;
1110 struct fiemap *fm_local = NULL;
1111 struct lov_stripe_md *lsm;
1112 loff_t fm_start;
^^^^^^^^
1113 loff_t fm_end;
1114 loff_t fm_length;
^^^^^^^^^^
These used to be u64 types but now they are signed.
1115 loff_t fm_end_offset;
1116 int count_local;
1117 int ost_index = 0;
1118 int start_stripe;
1119 int current_extent = 0;
1120 int rc = 0;
1121 int last_stripe;
1122 int cur_stripe = 0;
1123 int cur_stripe_wrap = 0;
1124 int stripe_count;
1125 /* Whether have we collected enough extents */
1126 bool enough = false;
1127 /* EOF for object */
1128 bool ost_eof = false;
1129 /* done with required mapping for this OST? */
1130 bool ost_done = false;
1131
[ snip ]
1231 /*
1232 * If this is a continuation FIEMAP call and we are on
1233 * starting stripe then lun_start needs to be set to
1234 * fm_end_offset
1235 */
1236 if (fm_end_offset && cur_stripe == start_stripe)
1237 lun_start = fm_end_offset;
1238
1239 if (fm_length != ~0ULL) {
1240 /* Handle fm_start + fm_length overflow */
1241 if (fm_start + fm_length < fm_start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
So, technically, this is undefined behavior now.
1242 fm_length = ~0ULL - fm_start;
1243 lun_end = lov_size_to_stripe(lsm, fm_start + fm_length,
1244 cur_stripe);
1245 } else {
1246 lun_end = ~0ULL;
1247 }
regards,
dan carpenter
reply other threads:[~2016-10-20 12:19 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=20161020121908.GA16578@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=lustre-devel@lists.lustre.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox