From: kbuild test robot <lkp@intel.com>
To: Brian Foster <bfoster@redhat.com>
Cc: kbuild-all@lists.01.org, linux-xfs@vger.kernel.org,
"Darrick J. Wong" <darrick.wong@oracle.com>
Subject: [xfs-linux:xfs-for-next 29/47] fs/xfs/libxfs/xfs_alloc.c:1170:41: sparse: sparse: Using plain integer as NULL pointer
Date: Sun, 20 Oct 2019 04:07:34 +0800 [thread overview]
Message-ID: <201910200432.0NRV75fO%lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git xfs-for-next
head: 722da94850334abacce34e63c670dcd9c79cad52
commit: aa056ce9548079d6b65c8b4a0d319eadff7dcd1b [29/47] xfs: introduce allocation cursor data structure
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-dirty
git checkout aa056ce9548079d6b65c8b4a0d319eadff7dcd1b
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> fs/xfs/libxfs/xfs_alloc.c:1170:41: sparse: sparse: Using plain integer as NULL pointer
vim +1170 fs/xfs/libxfs/xfs_alloc.c
1159
1160 /*
1161 * Allocate a variable extent near bno in the allocation group agno.
1162 * Extent's length (returned in len) will be between minlen and maxlen,
1163 * and of the form k * prod + mod unless there's nothing that large.
1164 * Return the starting a.g. block, or NULLAGBLOCK if we can't do it.
1165 */
1166 STATIC int
1167 xfs_alloc_ag_vextent_near(
1168 struct xfs_alloc_arg *args)
1169 {
> 1170 struct xfs_alloc_cur acur = {0,};
1171 struct xfs_btree_cur *bno_cur;
1172 xfs_agblock_t gtbno; /* start bno of right side entry */
1173 xfs_agblock_t gtbnoa; /* aligned ... */
1174 xfs_extlen_t gtdiff; /* difference to right side entry */
1175 xfs_extlen_t gtlen; /* length of right side entry */
1176 xfs_extlen_t gtlena; /* aligned ... */
1177 xfs_agblock_t gtnew; /* useful start bno of right side */
1178 int error; /* error code */
1179 int i; /* result code, temporary */
1180 int j; /* result code, temporary */
1181 xfs_agblock_t ltbno; /* start bno of left side entry */
1182 xfs_agblock_t ltbnoa; /* aligned ... */
1183 xfs_extlen_t ltdiff; /* difference to left side entry */
1184 xfs_extlen_t ltlen; /* length of left side entry */
1185 xfs_extlen_t ltlena; /* aligned ... */
1186 xfs_agblock_t ltnew; /* useful start bno of left side */
1187 xfs_extlen_t rlen; /* length of returned extent */
1188 bool busy;
1189 unsigned busy_gen;
1190 #ifdef DEBUG
1191 /*
1192 * Randomly don't execute the first algorithm.
1193 */
1194 int dofirst; /* set to do first algorithm */
1195
1196 dofirst = prandom_u32() & 1;
1197 #endif
1198
1199 /* handle unitialized agbno range so caller doesn't have to */
1200 if (!args->min_agbno && !args->max_agbno)
1201 args->max_agbno = args->mp->m_sb.sb_agblocks - 1;
1202 ASSERT(args->min_agbno <= args->max_agbno);
1203
1204 /* clamp agbno to the range if it's outside */
1205 if (args->agbno < args->min_agbno)
1206 args->agbno = args->min_agbno;
1207 if (args->agbno > args->max_agbno)
1208 args->agbno = args->max_agbno;
1209
1210 restart:
1211 ltlen = 0;
1212 gtlena = 0;
1213 ltlena = 0;
1214 busy = false;
1215
1216 /*
1217 * Set up cursors and see if there are any free extents as big as
1218 * maxlen. If not, pick the last entry in the tree unless the tree is
1219 * empty.
1220 */
1221 error = xfs_alloc_cur_setup(args, &acur);
1222 if (error == -ENOSPC) {
1223 error = xfs_alloc_ag_vextent_small(args, acur.cnt, <bno,
1224 <len, &i);
1225 if (error)
1226 goto out;
1227 if (i == 0 || ltlen == 0) {
1228 trace_xfs_alloc_near_noentry(args);
1229 goto out;
1230 }
1231 ASSERT(i == 1);
1232 } else if (error) {
1233 goto out;
1234 }
1235 args->wasfromfl = 0;
1236
1237 /*
1238 * First algorithm.
1239 * If the requested extent is large wrt the freespaces available
1240 * in this a.g., then the cursor will be pointing to a btree entry
1241 * near the right edge of the tree. If it's in the last btree leaf
1242 * block, then we just examine all the entries in that block
1243 * that are big enough, and pick the best one.
1244 * This is written as a while loop so we can break out of it,
1245 * but we never loop back to the top.
1246 */
1247 while (xfs_btree_islastblock(acur.cnt, 0)) {
1248 xfs_extlen_t bdiff;
1249 int besti=0;
1250 xfs_extlen_t blen=0;
1251 xfs_agblock_t bnew=0;
1252
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
next reply other threads:[~2019-10-19 20:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-19 20:07 kbuild test robot [this message]
2019-10-21 13:14 ` [PATCH] xfs: fix sparse warning on allocation cursor initialization Brian Foster
2019-10-21 15:45 ` Darrick J. Wong
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=201910200432.0NRV75fO%lkp@intel.com \
--to=lkp@intel.com \
--cc=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-xfs@vger.kernel.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