Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715577 > unrolled thread

[PATCH 2/4] isofs: Adjust four checks for null pointers

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-08-19 09:20 +0200
Last post2017-08-21 16:10 +0200
Articles 2 — 2 participants

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.


Contents

  [PATCH 2/4] isofs: Adjust four checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-19 09:20 +0200
    Re: [PATCH 2/4] isofs: Adjust four checks for null pointers Jan Kara <jack@suse.cz> - 2017-08-21 16:10 +0200

#1715577 — [PATCH 2/4] isofs: Adjust four checks for null pointers

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-08-19 09:20 +0200
Subject[PATCH 2/4] isofs: Adjust four checks for null pointers
Message-ID<ug6d3-6Hr-9@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 18 Aug 2017 21:47:14 +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 the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/isofs/inode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 2d3f090944df..db43f52f2268 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -96,7 +96,7 @@ static int __init init_inodecache(void)
 					0, (SLAB_RECLAIM_ACCOUNT|
 					SLAB_MEM_SPREAD|SLAB_ACCOUNT),
 					init_once);
-	if (isofs_inode_cachep == NULL)
+	if (!isofs_inode_cachep)
 		return -ENOMEM;
 	return 0;
 }
@@ -678,7 +678,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
 			if (isonum_711(vdp->type) == ISO_VD_END)
 				break;
 			if (isonum_711(vdp->type) == ISO_VD_PRIMARY) {
-				if (pri == NULL) {
+				if (!pri) {
 					pri = (struct iso_primary_descriptor *)vdp;
 					/* Save the buffer in case we need it ... */
 					pri_bh = bh;
@@ -742,7 +742,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
 		goto out_freebh;
 	}
 
-	if (joliet_level && (pri == NULL || !opt.rock)) {
+	if (joliet_level && (!pri || !opt.rock)) {
 		/* This is the case of Joliet with the norock mount flag.
 		 * A disc with both Joliet and Rock Ridge is handled later
 		 */
@@ -1320,5 +1320,5 @@ static int isofs_read_inode(struct inode *inode, int relocated)
 		int frag1 = bufsize - offset;
 
 		tmpde = kmalloc(de_len, GFP_KERNEL);
-		if (tmpde == NULL) {
+		if (!tmpde) {
 			ret = -ENOMEM;
-- 
2.14.0

[toc] | [next] | [standalone]


#1716521

FromJan Kara <jack@suse.cz>
Date2017-08-21 16:10 +0200
Message-ID<ugVyY-5o7-47@gated-at.bofh.it>
In reply to#1715577
On Sat 19-08-17 09:17:28, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 18 Aug 2017 21:47:14 +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 the affected source code places.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Thanks. Applied to my tree.

								Honza


> ---
>  fs/isofs/inode.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
> index 2d3f090944df..db43f52f2268 100644
> --- a/fs/isofs/inode.c
> +++ b/fs/isofs/inode.c
> @@ -96,7 +96,7 @@ static int __init init_inodecache(void)
>  					0, (SLAB_RECLAIM_ACCOUNT|
>  					SLAB_MEM_SPREAD|SLAB_ACCOUNT),
>  					init_once);
> -	if (isofs_inode_cachep == NULL)
> +	if (!isofs_inode_cachep)
>  		return -ENOMEM;
>  	return 0;
>  }
> @@ -678,7 +678,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
>  			if (isonum_711(vdp->type) == ISO_VD_END)
>  				break;
>  			if (isonum_711(vdp->type) == ISO_VD_PRIMARY) {
> -				if (pri == NULL) {
> +				if (!pri) {
>  					pri = (struct iso_primary_descriptor *)vdp;
>  					/* Save the buffer in case we need it ... */
>  					pri_bh = bh;
> @@ -742,7 +742,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
>  		goto out_freebh;
>  	}
>  
> -	if (joliet_level && (pri == NULL || !opt.rock)) {
> +	if (joliet_level && (!pri || !opt.rock)) {
>  		/* This is the case of Joliet with the norock mount flag.
>  		 * A disc with both Joliet and Rock Ridge is handled later
>  		 */
> @@ -1320,5 +1320,5 @@ static int isofs_read_inode(struct inode *inode, int relocated)
>  		int frag1 = bufsize - offset;
>  
>  		tmpde = kmalloc(de_len, GFP_KERNEL);
> -		if (tmpde == NULL) {
> +		if (!tmpde) {
>  			ret = -ENOMEM;
> -- 
> 2.14.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web