Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1601144
| From | "Tobin C. Harding" <me@tobin.cc> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] mmc: core: guard dereference of optional parameter |
| Date | 2017-03-15 09:50 +0100 |
| Message-ID | <tlcN3-573-13@gated-at.bofh.it> (permalink) |
| References | <tlcN3-573-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Various functions take as parameter an optional pointer. Pointer
should be guarded with non-NULL check before dereferencing.
Add non-NULL check before dereference of pointer.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
drivers/mmc/core/sdio_io.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index 74195d7..3482314 100644
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -373,7 +373,8 @@ u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret)
u8 val;
if (!func) {
- *err_ret = -EINVAL;
+ if (err_ret)
+ *err_ret = -EINVAL;
return 0xFF;
}
@@ -407,7 +408,8 @@ void sdio_writeb(struct sdio_func *func, u8 b, unsigned int addr, int *err_ret)
int ret;
if (!func) {
- *err_ret = -EINVAL;
+ if (err_ret)
+ *err_ret = -EINVAL;
return;
}
@@ -635,7 +637,8 @@ unsigned char sdio_f0_readb(struct sdio_func *func, unsigned int addr,
unsigned char val;
if (!func) {
- *err_ret = -EINVAL;
+ if (err_ret)
+ *err_ret = -EINVAL;
return 0xFF;
}
@@ -673,7 +676,8 @@ void sdio_f0_writeb(struct sdio_func *func, unsigned char b, unsigned int addr,
int ret;
if (!func) {
- *err_ret = -EINVAL;
+ if (err_ret)
+ *err_ret = -EINVAL;
return;
}
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] mmc: core: null pointer dereference bug "Tobin C. Harding" <me@tobin.cc> - 2017-03-15 09:50 +0100 [PATCH 2/2] mmc: core: simplify return code "Tobin C. Harding" <me@tobin.cc> - 2017-03-15 09:50 +0100 [PATCH 1/2] mmc: core: guard dereference of optional parameter "Tobin C. Harding" <me@tobin.cc> - 2017-03-15 09:50 +0100 Re: [PATCH 0/2] mmc: core: null pointer dereference bug Ulf Hansson <ulf.hansson@linaro.org> - 2017-03-16 15:50 +0100
csiph-web