Message ID | 20230725141602.7759-1-l3b2w1@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp2510771vqg; Tue, 25 Jul 2023 07:29:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlG3LM/8ONjMTc6xbNVLMfMdGue7grz2bTozVgvmvT7Ldn7O0tmPKKcqVpkELe3QNshwwHsz X-Received: by 2002:a05:6a20:1d0:b0:137:7add:b7cc with SMTP id 16-20020a056a2001d000b001377addb7ccmr10215581pzz.22.1690295350659; Tue, 25 Jul 2023 07:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690295350; cv=none; d=google.com; s=arc-20160816; b=ZDyCMkMukS7oucskocWOL4yycqfQMtCqyI8FvI2WpdqsNnMTWFUPAtoae7Z9EI0L0f FxJzPY6+nAakOwHkStiqpUOLcm393lisDixCWP2hqk1i+OACiS1SC3Pn+tdPFrC5D8zi nf5sknLjohE5Ap6TvxyERw2Pzh/YtXSz1lDLigw7ftcxFWWLynCod1ioKnM3JOTAOvjx mv+SiTN+WH7ai+RHmMsIYVszuAvtluB7LXpYxwbwCi1IXG37kVAytI5R0ubXRkuuwXq9 PfQLX/EHMDUhQN8GpGJbRWYGXcCkCUYb/9fAUExAoysmUOwaw6B57R5NwGwDqEZWVLTb q9CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=oFxuOTNi48idsZt2cpb80HlTb2Zev1a6Crwl3aXBH/I=; fh=oiRnod791P0JJHEsQGNQ5OEOaqrZsflXCUsTQzAtzHA=; b=whq8jpeRvPzzTomTADV9Lcf6qxsXq4/LjcSrw+ZrV09PX3DXeI2UPLiyUfeI6kAs8a 5b1doGpgGujoXNVnTm2+D4f3g8pazdNorcb6j9s+2P3s9FNLXSmpaBf5LsV6Esm2Cpnc NpCOnHjioRLa+jVJN0o4ARU7Bw4ANzgB2R3znflIzuSGvljKSuAeDUodU8RJOS85gV7h k2LbSIzCcWPUiD/itE8hYXf+lODwSBbsQRCsQlklcuH9q+HCjhB4SCz4ve0efqCzim1Q TxED4qC407L19ycWDRji8MO8U7x4GuEUsqYKUeznKHeCsRvTGMm+yqrEHzYFLaDQti1C 14Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Vnvg+6kr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020aa78883000000b0068254b9108bsi12077406pfe.71.2023.07.25.07.28.57; Tue, 25 Jul 2023 07:29:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Vnvg+6kr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232480AbjGYOUv (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Tue, 25 Jul 2023 10:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbjGYOUh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Jul 2023 10:20:37 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B98FA2680 for <linux-kernel@vger.kernel.org>; Tue, 25 Jul 2023 07:16:47 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6687466137bso3225697b3a.0 for <linux-kernel@vger.kernel.org>; Tue, 25 Jul 2023 07:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690294573; x=1690899373; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oFxuOTNi48idsZt2cpb80HlTb2Zev1a6Crwl3aXBH/I=; b=Vnvg+6kraoEV4R961SF/K60SkLscD6ltMXTv8foeY0JKks11+5r4lBp5ADRIJyrOGa d6n2xSvOx7v42sVgmO2CyW1JxwyEDLIUYxFU/u6LAykPSzMllz9OSI3L//5uBQazyOYr vCe6fhoGyES7upDBUZVVRCwUOzjt3V787cVK3tYVRXaVKTHb5X9DBhE+fA7x2cTnxfc2 4zscfVQYnRGlBpSkRDrLDAgcweyQv4q18QGI9NHE9wJAnCnUm5VKiGGfIW/ELbLw51GG 7zeRqRVYAQH19p4/3qTj+45e5XJS7pmB1NAopg+dGGPRH6LKSDZC2fUpsPpBulDZDDas mwZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690294573; x=1690899373; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oFxuOTNi48idsZt2cpb80HlTb2Zev1a6Crwl3aXBH/I=; b=LNAEH71F9qhUO7i1s5+Zaica7Lztx4gyzENv+wr+nbENN1a2UbEETGtYIU2J1l24+k mGzpCr0qDlFnd6j5M+nIEJZQT+Wox0b92uFJO4izXCHZ2AV9maXWmTWDQTz30pc68+eb VSpqheKT9PAOWq4zuMDYC9QX2WbpofUO/7MdPVRDvwUdhvxd7xkFbpuvtQU0ai+WdT5x qgUxYVVBNQDrbSGTES+dgpvkiCk6/qKBXBvtVc0o6Joxe3ZcCOvdJpmd7gUIgz8LjqLC 6JsY3C00jm7fQt1YuLCFDAyJVSmccsp4a4sQO9ZVh5nANjXCpKY6YGWqQf9FrBqeENFo Lm6w== X-Gm-Message-State: ABy/qLYE6DbzFh9bCxWJx/qfTUkne7ZoE775+zVfb5T2fW7C4zLkWelL 21WnQ7yAug/Rp1LDAC13ufFPqWXKLlqeJ93zh0Y= X-Received: by 2002:a05:6a20:841a:b0:135:4858:681 with SMTP id c26-20020a056a20841a00b0013548580681mr12732107pzd.9.1690294573391; Tue, 25 Jul 2023 07:16:13 -0700 (PDT) Received: from linux.. (static.111.40.78.5.clients.your-server.de. [5.78.40.111]) by smtp.gmail.com with ESMTPSA id l24-20020a62be18000000b0064f7c56d8b7sm9601482pff.219.2023.07.25.07.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 07:16:12 -0700 (PDT) From: Binglei Wang <l3b2w1@gmail.com> X-Google-Original-From: Binglei Wang To: hch@lst.de Cc: m.szyprowski@samsung.com, robin.murphy@arm.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, l3b2w1@gmail.com Subject: [PATCH v2] cma: check for memory region overlapping Date: Tue, 25 Jul 2023 22:16:02 +0800 Message-Id: <20230725141602.7759-1-l3b2w1@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772403137564831371 X-GMAIL-MSGID: 1772403137564831371 |
Series |
[v2] cma: check for memory region overlapping
|
|
Commit Message
Binglei Wang
July 25, 2023, 2:16 p.m. UTC
From: l3b2w1 <l3b2w1@gmail.com> Add a overlapping check in the program flow of paring dts. Check if cma area overlaps with memblock-reserved areas (kenrel code area for example)before calling early_init_fdt_scan_reserved_mem. Signed-off-by: l3b2w1 <l3b2w1@gmail.com> --- Notes: v2: delete the logic code for handling return EBUSY. v1: return EBUSY when detect overlapping and handle the return case. kernel/dma/contiguous.c | 5 +++++ 1 file changed, 5 insertions(+)
Comments
Hi Binglei, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.5-rc3 next-20230725] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Binglei-Wang/cma-check-for-memory-region-overlapping/20230725-222426 base: linus/master patch link: https://lore.kernel.org/r/20230725141602.7759-1-l3b2w1%40gmail.com patch subject: [PATCH v2] cma: check for memory region overlapping config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20230726/202307260010.zz6hkvQa-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 12.3.0 reproduce: (https://download.01.org/0day-ci/archive/20230726/202307260010.zz6hkvQa-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202307260010.zz6hkvQa-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from include/linux/dma-map-ops.h:9, from kernel/dma/contiguous.c:51: include/linux/dma-mapping.h: In function 'rmem_cma_setup': >> include/linux/dma-mapping.h:336:8: error: unterminated argument list invoking macro "pr_info" 336 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr), | ^ ~~~~~~~~~~~~~~~~~ >> kernel/dma/contiguous.c:414:17: error: 'pr_info' undeclared (first use in this function); did you mean 'qc_info'? 414 | pr_info("Reserved memory: overlap with other memblock reserved region\n", | ^~~~~~~ | qc_info kernel/dma/contiguous.c:414:17: note: each undeclared identifier is reported only once for each function it appears in >> kernel/dma/contiguous.c:414:24: error: expected ';' at end of input 414 | pr_info("Reserved memory: overlap with other memblock reserved region\n", | ^ | ; ...... >> kernel/dma/contiguous.c:414:17: error: expected declaration or statement at end of input 414 | pr_info("Reserved memory: overlap with other memblock reserved region\n", | ^~~~~~~ >> kernel/dma/contiguous.c:414:17: error: expected declaration or statement at end of input kernel/dma/contiguous.c:405:13: warning: unused variable 'err' [-Wunused-variable] 405 | int err; | ^~~ kernel/dma/contiguous.c:404:21: warning: unused variable 'cma' [-Wunused-variable] 404 | struct cma *cma; | ^~~ kernel/dma/contiguous.c: At top level: kernel/dma/contiguous.c:400:19: warning: 'rmem_cma_setup' defined but not used [-Wunused-function] 400 | static int __init rmem_cma_setup(struct reserved_mem *rmem) | ^~~~~~~~~~~~~~ kernel/dma/contiguous.c:395:38: warning: 'rmem_cma_ops' defined but not used [-Wunused-const-variable=] 395 | static const struct reserved_mem_ops rmem_cma_ops = { | ^~~~~~~~~~~~ vim +/pr_info +336 include/linux/dma-mapping.h 0d71675f87dc40 Christoph Hellwig 2020-09-01 327 2e05ea5cdc1ac5 Christoph Hellwig 2018-12-25 328 static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr, 2e05ea5cdc1ac5 Christoph Hellwig 2018-12-25 329 size_t size, enum dma_data_direction dir, unsigned long attrs) 2e05ea5cdc1ac5 Christoph Hellwig 2018-12-25 330 { 4544b9f25e70ea Kees Cook 2019-10-29 331 /* DMA must never operate on areas that might be remapped. */ 4544b9f25e70ea Kees Cook 2019-10-29 332 if (dev_WARN_ONCE(dev, is_vmalloc_addr(ptr), 4544b9f25e70ea Kees Cook 2019-10-29 333 "rejecting DMA map of vmalloc memory\n")) 4544b9f25e70ea Kees Cook 2019-10-29 334 return DMA_MAPPING_ERROR; 2e05ea5cdc1ac5 Christoph Hellwig 2018-12-25 335 debug_dma_map_single(dev, ptr, size); 2e05ea5cdc1ac5 Christoph Hellwig 2018-12-25 @336 return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr), 2e05ea5cdc1ac5 Christoph Hellwig 2018-12-25 337 size, dir, attrs); 2e05ea5cdc1ac5 Christoph Hellwig 2018-12-25 338 } 2e05ea5cdc1ac5 Christoph Hellwig 2018-12-25 339
Hi Binglei,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.5-rc3 next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Binglei-Wang/cma-check-for-memory-region-overlapping/20230725-222426
base: linus/master
patch link: https://lore.kernel.org/r/20230725141602.7759-1-l3b2w1%40gmail.com
patch subject: [PATCH v2] cma: check for memory region overlapping
config: riscv-randconfig-r042-20230725 (https://download.01.org/0day-ci/archive/20230726/202307260113.tCZQvjkf-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230726/202307260113.tCZQvjkf-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307260113.tCZQvjkf-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from arch/riscv/include/asm/elf.h:12,
from include/linux/elf.h:6,
from include/linux/module.h:19,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from include/linux/dma-mapping.h:8,
from include/linux/dma-map-ops.h:9,
from kernel/dma/contiguous.c:51:
include/linux/compat.h: In function 'rmem_cma_setup':
>> include/linux/compat.h:510:32: error: unterminated argument list invoking macro "pr_info"
510 | unsafe_get_user(hi, &__c->sig[2], label); \
| ^
kernel/dma/contiguous.c:414:17: error: 'pr_info' undeclared (first use in this function); did you mean 'qc_info'?
414 | pr_info("Reserved memory: overlap with other memblock reserved region\n",
| ^~~~~~~
| qc_info
kernel/dma/contiguous.c:414:17: note: each undeclared identifier is reported only once for each function it appears in
kernel/dma/contiguous.c:414:24: error: expected ';' at end of input
414 | pr_info("Reserved memory: overlap with other memblock reserved region\n",
| ^
| ;
......
kernel/dma/contiguous.c:414:17: error: expected declaration or statement at end of input
414 | pr_info("Reserved memory: overlap with other memblock reserved region\n",
| ^~~~~~~
kernel/dma/contiguous.c:414:17: error: expected declaration or statement at end of input
kernel/dma/contiguous.c:405:13: warning: unused variable 'err' [-Wunused-variable]
405 | int err;
| ^~~
kernel/dma/contiguous.c:404:21: warning: unused variable 'cma' [-Wunused-variable]
404 | struct cma *cma;
| ^~~
kernel/dma/contiguous.c: At top level:
kernel/dma/contiguous.c:400:19: warning: 'rmem_cma_setup' defined but not used [-Wunused-function]
400 | static int __init rmem_cma_setup(struct reserved_mem *rmem)
| ^~~~~~~~~~~~~~
kernel/dma/contiguous.c:395:38: warning: 'rmem_cma_ops' defined but not used [-Wunused-const-variable=]
395 | static const struct reserved_mem_ops rmem_cma_ops = {
| ^~~~~~~~~~~~
vim +/pr_info +510 include/linux/compat.h
fb05121fd6a20f0 Christophe Leroy 2021-03-19 491
fb05121fd6a20f0 Christophe Leroy 2021-03-19 492 #define unsafe_get_compat_sigset(set, compat, label) do { \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 493 const compat_sigset_t __user *__c = compat; \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 494 compat_sigset_word hi, lo; \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 495 sigset_t *__s = set; \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 496 \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 497 switch (_NSIG_WORDS) { \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 498 case 4: \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 499 unsafe_get_user(lo, &__c->sig[7], label); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 500 unsafe_get_user(hi, &__c->sig[6], label); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 501 __s->sig[3] = hi | (((long)lo) << 32); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 502 fallthrough; \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 503 case 3: \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 504 unsafe_get_user(lo, &__c->sig[5], label); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 505 unsafe_get_user(hi, &__c->sig[4], label); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 506 __s->sig[2] = hi | (((long)lo) << 32); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 507 fallthrough; \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 508 case 2: \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 509 unsafe_get_user(lo, &__c->sig[3], label); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 @510 unsafe_get_user(hi, &__c->sig[2], label); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 511 __s->sig[1] = hi | (((long)lo) << 32); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 512 fallthrough; \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 513 case 1: \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 514 unsafe_get_user(lo, &__c->sig[1], label); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 515 unsafe_get_user(hi, &__c->sig[0], label); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 516 __s->sig[0] = hi | (((long)lo) << 32); \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 517 } \
fb05121fd6a20f0 Christophe Leroy 2021-03-19 518 } while (0)
14026b94ccfe626 Christophe Leroy 2020-08-18 519 #else
14026b94ccfe626 Christophe Leroy 2020-08-18 520 #define unsafe_put_compat_sigset(compat, set, label) do { \
14026b94ccfe626 Christophe Leroy 2020-08-18 521 compat_sigset_t __user *__c = compat; \
14026b94ccfe626 Christophe Leroy 2020-08-18 522 const sigset_t *__s = set; \
14026b94ccfe626 Christophe Leroy 2020-08-18 523 \
14026b94ccfe626 Christophe Leroy 2020-08-18 524 unsafe_copy_to_user(__c, __s, sizeof(*__c), label); \
14026b94ccfe626 Christophe Leroy 2020-08-18 525 } while (0)
fb05121fd6a20f0 Christophe Leroy 2021-03-19 526
Hi Binglei, kernel test robot noticed the following build warnings: [auto build test WARNING on linus/master] [also build test WARNING on v6.5-rc3 next-20230725] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Binglei-Wang/cma-check-for-memory-region-overlapping/20230725-222426 base: linus/master patch link: https://lore.kernel.org/r/20230725141602.7759-1-l3b2w1%40gmail.com patch subject: [PATCH v2] cma: check for memory region overlapping config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230726/202307260509.OMkcRpqC-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230726/202307260509.OMkcRpqC-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202307260509.OMkcRpqC-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from include/linux/elf.h:6, from include/linux/module.h:19, from include/linux/device/driver.h:21, from include/linux/device.h:32, from include/linux/dma-mapping.h:8, from include/linux/dma-map-ops.h:9, from kernel/dma/contiguous.c:51: arch/x86/include/asm/elf.h: In function 'rmem_cma_setup': arch/x86/include/asm/elf.h:204:29: error: unterminated argument list invoking macro "pr_info" 204 | (pr_reg)[11] = (regs)->cx; \ | ^ kernel/dma/contiguous.c:414:17: error: 'pr_info' undeclared (first use in this function); did you mean 'pv_info'? 414 | pr_info("Reserved memory: overlap with other memblock reserved region\n", | ^~~~~~~ | pv_info kernel/dma/contiguous.c:414:17: note: each undeclared identifier is reported only once for each function it appears in kernel/dma/contiguous.c:414:24: error: expected ';' at end of input 414 | pr_info("Reserved memory: overlap with other memblock reserved region\n", | ^ | ; ...... kernel/dma/contiguous.c:414:17: error: expected declaration or statement at end of input 414 | pr_info("Reserved memory: overlap with other memblock reserved region\n", | ^~~~~~~ kernel/dma/contiguous.c:414:17: error: expected declaration or statement at end of input >> kernel/dma/contiguous.c:405:13: warning: unused variable 'err' [-Wunused-variable] 405 | int err; | ^~~ >> kernel/dma/contiguous.c:404:21: warning: unused variable 'cma' [-Wunused-variable] 404 | struct cma *cma; | ^~~ kernel/dma/contiguous.c: At top level: >> kernel/dma/contiguous.c:400:19: warning: 'rmem_cma_setup' defined but not used [-Wunused-function] 400 | static int __init rmem_cma_setup(struct reserved_mem *rmem) | ^~~~~~~~~~~~~~ >> kernel/dma/contiguous.c:395:38: warning: 'rmem_cma_ops' defined but not used [-Wunused-const-variable=] 395 | static const struct reserved_mem_ops rmem_cma_ops = { | ^~~~~~~~~~~~ vim +/err +405 kernel/dma/contiguous.c de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 394 de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 @395 static const struct reserved_mem_ops rmem_cma_ops = { de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 396 .device_init = rmem_cma_device_init, de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 397 .device_release = rmem_cma_device_release, de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 398 }; de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 399 de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 @400 static int __init rmem_cma_setup(struct reserved_mem *rmem) de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 401 { de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 402 unsigned long node = rmem->fdt_node; 8c8c5a4994a306 kernel/dma/contiguous.c Nicolas Saenz Julienne 2020-01-10 403 bool default_cma = of_get_flat_dt_prop(node, "linux,cma-default", NULL); de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 @404 struct cma *cma; de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 @405 int err;
diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index 6ea80ae42..20ebbcefd 100644 --- a/kernel/dma/contiguous.c +++ b/kernel/dma/contiguous.c @@ -410,6 +410,11 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem) return -EBUSY; } + if (memblock_is_region_reserved(rmem->base, rmem->size)) { + pr_info("Reserved memory: overlap with other memblock reserved region\n", + return -EBUSY; + } + if (!of_get_flat_dt_prop(node, "reusable", NULL) || of_get_flat_dt_prop(node, "no-map", NULL)) return -EINVAL;