From: nathanj439@gmail.com (Nathan Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: dma-mapping: fix potential uninitialized return
Date: Wed, 28 Nov 2018 12:39:29 -0500 [thread overview]
Message-ID: <20181128173929.3050-1-nathanj439@gmail.com> (raw)
If neither of the if() statements fire then the return value is
uninitialized. In the worst case it returns 0 which means the caller
will think the function succeeded.
Signed-off-by: Nathan Jones <nathanj439@gmail.com>
---
arch/arm/mm/dma-mapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 661fe48ab78d..78de138aa66d 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -829,7 +829,7 @@ static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size,
unsigned long attrs)
{
- int ret;
+ int ret = -ENXIO;
unsigned long nr_vma_pages = vma_pages(vma);
unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
unsigned long pfn = dma_to_pfn(dev, dma_addr);
--
2.19.1
next reply other threads:[~2018-11-28 17:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-28 17:39 Nathan Jones [this message]
2018-11-28 17:47 ` [PATCH] ARM: dma-mapping: fix potential uninitialized return Russell King - ARM Linux
2018-11-28 18:59 ` [PATCH v2] " Nathan Jones
2018-11-29 9:50 ` Vladimir Murzin
2018-11-29 10:11 ` Vladimir Murzin
2018-11-29 10:22 ` Russell King - ARM Linux
2018-11-29 16:26 ` Christoph Hellwig
2018-11-29 10:14 ` Russell King - ARM Linux
2018-11-29 14:58 ` Nathan Jones
2018-11-29 15:24 ` Russell King - ARM Linux
2018-11-30 9:00 ` Vladimir Murzin
2018-11-29 15:17 ` Robin Murphy
2018-11-30 13:07 ` [PATCH v3] " Nathan Jones
2018-12-04 9:09 ` Vladimir Murzin
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=20181128173929.3050-1-nathanj439@gmail.com \
--to=nathanj439@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.