Re: [PATCH] drivers: fix a memory leak

From: kbuild test robot
Date: Sat Nov 09 2019 - 08:08:53 EST


Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v5.4-rc6 next-20191108]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/wu000273-umn-edu/drivers-fix-a-memory-leak/20191109-191819
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git bce92136c28f3ae9ddbbac0ee7c0df2eb0ae0bef
config: x86_64-rhel (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/char/agp/intel-gtt.c: In function 'intel_gtt_setup_scratch_page':
>> drivers/char/agp/intel-gtt.c:308:4: error: too few arguments to function '__free_pages'
__free_pages(page);
^~~~~~~~~~~~
In file included from include/linux/umh.h:4:0,
from include/linux/kmod.h:9,
from include/linux/module.h:13,
from drivers/char/agp/intel-gtt.c:18:
include/linux/gfp.h:543:13: note: declared here
extern void __free_pages(struct page *page, unsigned int order);
^~~~~~~~~~~~

vim +/__free_pages +308 drivers/char/agp/intel-gtt.c

293
294 static int intel_gtt_setup_scratch_page(void)
295 {
296 struct page *page;
297 dma_addr_t dma_addr;
298
299 page = alloc_page(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO);
300 if (page == NULL)
301 return -ENOMEM;
302 set_pages_uc(page, 1);
303
304 if (intel_private.needs_dmar) {
305 dma_addr = pci_map_page(intel_private.pcidev, page, 0,
306 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
307 if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) {
> 308 __free_pages(page);
309 return -EINVAL;
310 }
311
312 intel_private.scratch_page_dma = dma_addr;
313 } else
314 intel_private.scratch_page_dma = page_to_phys(page);
315
316 intel_private.scratch_page = page;
317
318 return 0;
319 }
320

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip