* [mmotm:master 9/285] mm/hugetlb.c:4378:2: error: invalid use of void expression
@ 2018-03-14 6:21 kbuild test robot
0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2018-03-14 6:21 UTC (permalink / raw)
To: Andrew Morton
Cc: kbuild-all, Linux Memory Management List, Mike Kravetz, Johannes Weiner
[-- Attachment #1: Type: text/plain, Size: 5539 bytes --]
tree: git://git.cmpxchg.org/linux-mmotm.git master
head: ead058c4ec49752a4e0323368f1d695385c66020
commit: 0fde5444264108c91dfea4c0b756f2470a4a4a3b [9/285] hugetlbfs-check-for-pgoff-value-overflow-v3-fix
config: i386-randconfig-s0-201810 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
git checkout 0fde5444264108c91dfea4c0b756f2470a4a4a3b
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
mm/hugetlb.c: In function 'hugetlb_reserve_pages':
>> mm/hugetlb.c:4378:2: error: invalid use of void expression
if (VM_WARN(from > to, "%s called with a negative range\n", __func__))
^~
>> mm/hugetlb.c:4378:2: error: invalid use of void expression
In file included from include/linux/kernel.h:10:0,
from include/linux/list.h:9,
from mm/hugetlb.c:5:
include/linux/compiler.h:61:17: error: invalid use of void expression
static struct ftrace_branch_data \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
mm/hugetlb.c:4378:2: note: in expansion of macro 'if'
if (VM_WARN(from > to, "%s called with a negative range\n", __func__))
^~
vim +4378 mm/hugetlb.c
4366
4367 int hugetlb_reserve_pages(struct inode *inode,
4368 long from, long to,
4369 struct vm_area_struct *vma,
4370 vm_flags_t vm_flags)
4371 {
4372 long ret, chg;
4373 struct hstate *h = hstate_inode(inode);
4374 struct hugepage_subpool *spool = subpool_inode(inode);
4375 struct resv_map *resv_map;
4376 long gbl_reserve;
4377
> 4378 if (VM_WARN(from > to, "%s called with a negative range\n", __func__))
4379 return -EINVAL;
4380
4381 /*
4382 * Only apply hugepage reservation if asked. At fault time, an
4383 * attempt will be made for VM_NORESERVE to allocate a page
4384 * without using reserves
4385 */
4386 if (vm_flags & VM_NORESERVE)
4387 return 0;
4388
4389 /*
4390 * Shared mappings base their reservation on the number of pages that
4391 * are already allocated on behalf of the file. Private mappings need
4392 * to reserve the full area even if read-only as mprotect() may be
4393 * called to make the mapping read-write. Assume !vma is a shm mapping
4394 */
4395 if (!vma || vma->vm_flags & VM_MAYSHARE) {
4396 resv_map = inode_resv_map(inode);
4397
4398 chg = region_chg(resv_map, from, to);
4399
4400 } else {
4401 resv_map = resv_map_alloc();
4402 if (!resv_map)
4403 return -ENOMEM;
4404
4405 chg = to - from;
4406
4407 set_vma_resv_map(vma, resv_map);
4408 set_vma_resv_flags(vma, HPAGE_RESV_OWNER);
4409 }
4410
4411 if (chg < 0) {
4412 ret = chg;
4413 goto out_err;
4414 }
4415
4416 /*
4417 * There must be enough pages in the subpool for the mapping. If
4418 * the subpool has a minimum size, there may be some global
4419 * reservations already in place (gbl_reserve).
4420 */
4421 gbl_reserve = hugepage_subpool_get_pages(spool, chg);
4422 if (gbl_reserve < 0) {
4423 ret = -ENOSPC;
4424 goto out_err;
4425 }
4426
4427 /*
4428 * Check enough hugepages are available for the reservation.
4429 * Hand the pages back to the subpool if there are not
4430 */
4431 ret = hugetlb_acct_memory(h, gbl_reserve);
4432 if (ret < 0) {
4433 /* put back original number of pages, chg */
4434 (void)hugepage_subpool_put_pages(spool, chg);
4435 goto out_err;
4436 }
4437
4438 /*
4439 * Account for the reservations made. Shared mappings record regions
4440 * that have reservations as they are shared by multiple VMAs.
4441 * When the last VMA disappears, the region map says how much
4442 * the reservation was and the page cache tells how much of
4443 * the reservation was consumed. Private mappings are per-VMA and
4444 * only the consumed reservations are tracked. When the VMA
4445 * disappears, the original reservation is the VMA size and the
4446 * consumed reservations are stored in the map. Hence, nothing
4447 * else has to be done for private mappings here
4448 */
4449 if (!vma || vma->vm_flags & VM_MAYSHARE) {
4450 long add = region_add(resv_map, from, to);
4451
4452 if (unlikely(chg > add)) {
4453 /*
4454 * pages in this range were added to the reserve
4455 * map between region_chg and region_add. This
4456 * indicates a race with alloc_huge_page. Adjust
4457 * the subpool and reserve counts modified above
4458 * based on the difference.
4459 */
4460 long rsv_adjust;
4461
4462 rsv_adjust = hugepage_subpool_put_pages(spool,
4463 chg - add);
4464 hugetlb_acct_memory(h, -rsv_adjust);
4465 }
4466 }
4467 return 0;
4468 out_err:
4469 if (!vma || vma->vm_flags & VM_MAYSHARE)
4470 /* Don't call region_abort if region_chg failed */
4471 if (chg >= 0)
4472 region_abort(resv_map, from, to);
4473 if (vma && is_vma_resv_set(vma, HPAGE_RESV_OWNER))
4474 kref_put(&resv_map->refs, resv_map_release);
4475 return ret;
4476 }
4477
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27902 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-03-14 6:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 6:21 [mmotm:master 9/285] mm/hugetlb.c:4378:2: error: invalid use of void expression kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox