Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1713254 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-08-16 21:30 +0200 |
| Last post | 2017-08-16 21:40 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/3] pstore: Adjustments for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-16 21:30 +0200
[PATCH 3/3] pstore: Adjust two checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-16 21:30 +0200
Re: [PATCH 3/3] pstore: Adjust two checks for null pointers Kees Cook <keescook@chromium.org> - 2017-08-16 21:40 +0200
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-08-16 21:30 +0200 |
| Subject | [PATCH 0/3] pstore: Adjustments for some function implementations |
| Message-ID | <ufcaS-2DT-9@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 16 Aug 2017 21:06:54 +0200 Three update suggestions were taken into account from static source code analysis. Markus Elfring (3): Delete six error messages for a failed memory allocation Improve a size determination in three functions Adjust two checks for null pointers fs/pstore/ram.c | 11 +++-------- fs/pstore/ram_core.c | 21 +++++++-------------- 2 files changed, 10 insertions(+), 22 deletions(-) -- 2.14.0
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-08-16 21:30 +0200 |
| Subject | [PATCH 3/3] pstore: Adjust two checks for null pointers |
| Message-ID | <ufcaS-2DT-15@gated-at.bofh.it> |
| In reply to | #1713254 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 16 Aug 2017 21:00:16 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written !…
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
fs/pstore/ram.c | 2 +-
fs/pstore/ram_core.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 0ef95c384bed..38b81868f7f9 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -333,7 +333,7 @@ static ssize_t ramoops_pstore_read(struct pstore_record *record)
record->ecc_notice_size = persistent_ram_ecc_string(prz, NULL, 0);
record->buf = kmalloc(size + record->ecc_notice_size + 1, GFP_KERNEL);
- if (record->buf == NULL) {
+ if (!record->buf) {
size = -ENOMEM;
goto out;
}
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 5d9f7280d757..e37b2d0cb9f4 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -223,7 +223,7 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz,
*/
prz->rs_decoder = init_rs(prz->ecc_info.symsize, prz->ecc_info.poly,
0, 1, prz->ecc_info.ecc_size);
- if (prz->rs_decoder == NULL) {
+ if (!prz->rs_decoder) {
pr_info("init_rs failed\n");
return -EINVAL;
}
--
2.14.0
[toc] | [prev] | [next] | [standalone]
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Date | 2017-08-16 21:40 +0200 |
| Subject | Re: [PATCH 3/3] pstore: Adjust two checks for null pointers |
| Message-ID | <ufcky-2IV-15@gated-at.bofh.it> |
| In reply to | #1713255 |
On Wed, Aug 16, 2017 at 12:23 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 16 Aug 2017 21:00:16 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The script “checkpatch.pl” pointed information out like the following.
>
> Comparison to NULL could be written !…
>
> Thus fix affected source code places.
I think these are find to do when changing other code, but as
stand-alone, I'm not interested in taking them, sorry!
-Kees
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> fs/pstore/ram.c | 2 +-
> fs/pstore/ram_core.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index 0ef95c384bed..38b81868f7f9 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -333,7 +333,7 @@ static ssize_t ramoops_pstore_read(struct pstore_record *record)
> record->ecc_notice_size = persistent_ram_ecc_string(prz, NULL, 0);
>
> record->buf = kmalloc(size + record->ecc_notice_size + 1, GFP_KERNEL);
> - if (record->buf == NULL) {
> + if (!record->buf) {
> size = -ENOMEM;
> goto out;
> }
> diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
> index 5d9f7280d757..e37b2d0cb9f4 100644
> --- a/fs/pstore/ram_core.c
> +++ b/fs/pstore/ram_core.c
> @@ -223,7 +223,7 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz,
> */
> prz->rs_decoder = init_rs(prz->ecc_info.symsize, prz->ecc_info.poly,
> 0, 1, prz->ecc_info.ecc_size);
> - if (prz->rs_decoder == NULL) {
> + if (!prz->rs_decoder) {
> pr_info("init_rs failed\n");
> return -EINVAL;
> }
> --
> 2.14.0
>
--
Kees Cook
Pixel Security
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web