Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1562921 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-01-19 18:00 +0100 |
| Last post | 2017-01-19 18:00 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 4/8] powerpc/nvram: Return directly after a failed parameter validation in dev_nvram_read() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-19 18:00 +0100
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-01-19 18:00 +0100 |
| Subject | [PATCH 4/8] powerpc/nvram: Return directly after a failed parameter validation in dev_nvram_read() |
| Message-ID | <t1oe5-40V-17@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 19 Jan 2017 16:12:48 +0100
* Return directly after an inappropriate input parameter was detected.
* Delete an initialisation for the variable "tmp" at the beginning
which became unnecessary with this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/powerpc/kernel/nvram_64.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index dc90a0e9ad65..463551589b97 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -745,24 +745,18 @@ static ssize_t dev_nvram_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
ssize_t ret;
- char *tmp = NULL;
+ char *tmp;
ssize_t size;
- if (!ppc_md.nvram_size) {
- ret = -ENODEV;
- goto out;
- }
+ if (!ppc_md.nvram_size)
+ return -ENODEV;
size = ppc_md.nvram_size();
- if (size < 0) {
- ret = size;
- goto out;
- }
+ if (size < 0)
+ return size;
- if (*ppos >= size) {
- ret = 0;
- goto out;
- }
+ if (*ppos >= size)
+ return 0;
count = min_t(size_t, count, size - *ppos);
count = min(count, PAGE_SIZE);
--
2.11.0
Back to top | Article view | linux.kernel
csiph-web