All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix ptr_ret.cocci warnings
@ 2017-05-15 10:52 Julia Lawall
  2017-05-15 10:56 ` Stephan Müller
  0 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2017-05-15 10:52 UTC (permalink / raw)
  To: Stephan Müller
  Cc: linux-kernel, linux-crypto, Jason A. Donenfeld, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

CC: Stephan Müller <smueller@chronox.de>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

Not very important, but the code can be a little simpler.

 lrng_base.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/char/lrng_base.c
+++ b/drivers/char/lrng_base.c
@@ -1523,10 +1523,7 @@ static int lrng_alloc(void)
 	lrng_init_rng(key, sizeof(key));
 	lrng_pool.lrng_hash = lrng_hash_alloc(LRNG_HASH_NAME, key, sizeof(key));
 	memzero_explicit(key, sizeof(key));
-	if (IS_ERR(lrng_pool.lrng_hash))
-		return PTR_ERR(lrng_pool.lrng_hash);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(lrng_pool.lrng_hash);
 }

 /************************** LRNG kernel interfaces ***************************/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* [ebiggers:cryptobench 1/1] crypto/benchmark.c:616:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2020-08-27  1:41 kernel test robot
  2020-08-27  1:41 ` [PATCH] fix ptr_ret.cocci warnings kernel test robot
  0 siblings, 1 reply; 24+ messages in thread
From: kernel test robot @ 2020-08-27  1:41 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git cryptobench
head:   14f42ca5c1a289b166e7e162b45577adffc7a28f
commit: 14f42ca5c1a289b166e7e162b45577adffc7a28f [1/1] [TESTING, DO NOT MERGE] crypto - add benchmark and testing module
config: i386-randconfig-c001-20200826 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

>> crypto/benchmark.c:616:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36168 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread
* drivers/pci/controller/pcie-rockchip-host.c:628:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2019-12-21  1:18 kbuild test robot
  2019-12-21  1:18   ` kbuild test robot
  0 siblings, 1 reply; 24+ messages in thread
From: kbuild test robot @ 2019-12-21  1:18 UTC (permalink / raw)
  To: Lorenzo Pieralisi; +Cc: kbuild-all, linux-kernel, Bjorn Helgaas

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b371ddb94fae82b6565020639b7db31934043c65
commit: 069ade5dfec93dd2916a85df8b1bab2d578857bd Merge branch 'remotes/lorenzo/pci/rockchip'
date:   3 weeks ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/pci/controller/pcie-rockchip-host.c:628:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

^ permalink raw reply	[flat|nested] 24+ messages in thread
* [wsa:renesas/i2c/new_dummy 5/5] drivers/i2c/busses/i2c-nvidia-gpu.c:284:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2019-10-09 11:32 kbuild test robot
  2019-10-09 11:32 ` [PATCH] fix ptr_ret.cocci warnings kbuild test robot
  0 siblings, 1 reply; 24+ messages in thread
From: kbuild test robot @ 2019-10-09 11:32 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 661 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/i2c/new_dummy
head:   b401cd1e73e824b8e1231b97c36b7fa21017b669
commit: b401cd1e73e824b8e1231b97c36b7fa21017b669 [5/5] plain

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/i2c/busses/i2c-nvidia-gpu.c:284:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 24+ messages in thread
* [PATCH v2 10/13] NFS inter ssc open
@ 2018-10-24 19:58 Olga Kornievskaia
  2018-10-25  1:31 ` [PATCH] fix ptr_ret.cocci warnings kbuild test robot
  0 siblings, 1 reply; 24+ messages in thread
From: Olga Kornievskaia @ 2018-10-24 19:58 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker, viro, smfrench, miklos
  Cc: linux-nfs, linux-fsdevel, linux-cifs, linux-unionfs, linux-man

From: Olga Kornievskaia <kolga@netapp.com>

NFSv4.2 inter server to server copy requires the destination server to
READ the data from the source server using the provided stateid and
file handle.

Given an NFSv4 stateid and filehandle from the COPY operaion, provide the
destination server with an NFS client function to create a struct file
suitable for the destiniation server to READ the data to be copied.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/nfs4_fs.h  |  7 ++++
 fs/nfs/nfs4file.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/nfs/nfs4proc.c |  5 ++-
 3 files changed, 106 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 7d17b31..9c566a4 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -307,6 +307,13 @@ extern int nfs4_set_rw_stateid(nfs4_stateid *stateid,
 		const struct nfs_open_context *ctx,
 		const struct nfs_lock_context *l_ctx,
 		fmode_t fmode);
+extern int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
+			     struct nfs_fattr *fattr, struct nfs4_label *label,
+			     struct inode *inode);
+extern int update_open_stateid(struct nfs4_state *state,
+				const nfs4_stateid *open_stateid,
+				const nfs4_stateid *deleg_stateid,
+				fmode_t fmode);
 
 #if defined(CONFIG_NFS_V4_1)
 extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 703b56f..300880f 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -8,6 +8,7 @@
 #include <linux/file.h>
 #include <linux/falloc.h>
 #include <linux/nfs_fs.h>
+#include <linux/file.h>
 #include "delegation.h"
 #include "internal.h"
 #include "iostat.h"
@@ -264,6 +265,102 @@ static int nfs42_clone_file_range(struct file *src_file, loff_t src_off,
 out:
 	return ret;
 }
+
+static int read_name_gen = 1;
+#define SSC_READ_NAME_BODY "ssc_read_%d"
+
+struct file *
+nfs42_ssc_open(struct vfsmount *ss_mnt, struct nfs_fh *src_fh,
+		nfs4_stateid *stateid)
+{
+	struct nfs_fattr fattr;
+	struct file *filep, *res;
+	struct nfs_server *server;
+	struct inode *r_ino = NULL;
+	struct nfs_open_context *ctx;
+	struct nfs4_state_owner *sp;
+	char *read_name;
+	int len, status = 0;
+
+	server = NFS_SERVER(ss_mnt->mnt_root->d_inode);
+
+	nfs_fattr_init(&fattr);
+
+	status = nfs4_proc_getattr(server, src_fh, &fattr, NULL, NULL);
+	if (status < 0) {
+		res = ERR_PTR(status);
+		goto out;
+	}
+
+	res = ERR_PTR(-ENOMEM);
+	len = strlen(SSC_READ_NAME_BODY) + 16;
+	read_name = kzalloc(len, GFP_NOFS);
+	if (read_name == NULL)
+		goto out;
+	snprintf(read_name, len, SSC_READ_NAME_BODY, read_name_gen++);
+
+	r_ino = nfs_fhget(ss_mnt->mnt_root->d_inode->i_sb, src_fh, &fattr,
+			NULL);
+	if (IS_ERR(r_ino)) {
+		res = ERR_CAST(r_ino);
+		goto out;
+	}
+
+	filep = alloc_file_pseudo(r_ino, ss_mnt, read_name, FMODE_READ,
+				     r_ino->i_fop);
+	if (IS_ERR(filep)) {
+		res = ERR_CAST(filep);
+		goto out;
+	}
+	filep->f_mode |= FMODE_READ;
+
+	ctx = alloc_nfs_open_context(filep->f_path.dentry, filep->f_mode,
+					filep);
+	if (IS_ERR(ctx)) {
+		res = ERR_CAST(ctx);
+		goto out_filep;
+	}
+
+	res = ERR_PTR(-EINVAL);
+	sp = nfs4_get_state_owner(server, ctx->cred, GFP_KERNEL);
+	if (sp == NULL)
+		goto out_ctx;
+
+	ctx->state = nfs4_get_open_state(r_ino, sp);
+	if (ctx->state == NULL)
+		goto out_stateowner;
+
+	set_bit(NFS_OPEN_STATE, &ctx->state->flags);
+	memcpy(&ctx->state->open_stateid.other, &stateid->other,
+	       NFS4_STATEID_OTHER_SIZE);
+	update_open_stateid(ctx->state, stateid, NULL, filep->f_mode);
+
+	nfs_file_set_open_context(filep, ctx);
+	put_nfs_open_context(ctx);
+
+	file_ra_state_init(&filep->f_ra, filep->f_mapping->host->i_mapping);
+	res = filep;
+out:
+	dprintk("<-- %s error %ld filep %p r_ino %p\n",
+		__func__, IS_ERR(res) ? PTR_ERR(res) : 0, res, r_ino);
+
+	return res;
+out_stateowner:
+	nfs4_put_state_owner(sp);
+out_ctx:
+	put_nfs_open_context(ctx);
+out_filep:
+	fput(filep);
+	goto out;
+}
+EXPORT_SYMBOL_GPL(nfs42_ssc_open);
+void nfs42_ssc_close(struct file *filep)
+{
+	struct nfs_open_context *ctx = nfs_file_open_context(filep);
+
+	ctx->state->flags = 0;
+}
+EXPORT_SYMBOL_GPL(nfs42_ssc_close);
 #endif /* CONFIG_NFS_V4_2 */
 
 const struct file_operations nfs4_file_operations = {
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index fec6e6b..e5178b2f 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -91,7 +91,6 @@
 static int _nfs4_recover_proc_open(struct nfs4_opendata *data);
 static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *);
 static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr);
-static int nfs4_proc_getattr(struct nfs_server *, struct nfs_fh *, struct nfs_fattr *, struct nfs4_label *label, struct inode *inode);
 static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs4_label *label, struct inode *inode);
 static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
 			    struct nfs_fattr *fattr, struct iattr *sattr,
@@ -1653,7 +1652,7 @@ static void nfs_state_clear_delegation(struct nfs4_state *state)
 	write_sequnlock(&state->seqlock);
 }
 
-static int update_open_stateid(struct nfs4_state *state,
+int update_open_stateid(struct nfs4_state *state,
 		const nfs4_stateid *open_stateid,
 		const nfs4_stateid *delegation,
 		fmode_t fmode)
@@ -3936,7 +3935,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
 	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
 }
 
-static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
+int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
 				struct nfs_fattr *fattr, struct nfs4_label *label,
 				struct inode *inode)
 {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread
* Re: [PATCH v8 3/3] backlight arcxcnn add support for ArcticSand devices
  2017-03-15 19:45 ` Olimpiu Dejeu
@ 2017-03-17 14:48 kbuild test robot
  2017-03-15 19:45 ` Olimpiu Dejeu
  0 siblings, 1 reply; 24+ messages in thread
From: kbuild test robot @ 2017-03-17 14:48 UTC (permalink / raw)
  To: Olimpiu Dejeu
  Cc: kbuild-all, robh, lee.jones, linux-kernel, linux-fbdev,
	devicetree, jingoohan1, bdodge, joe, medasaro, daniel.thompson,
	Olimpiu Dejeu

Hi Olimpiu,

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.11-rc2 next-20170310]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Olimpiu-Dejeu/backlight-arcxcnn-add-arc-to-vendor-prefix/20170317-205447
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next


coccinelle warnings: (new ones prefixed by >>)

>> drivers/video/backlight/arcxcnn_bl.c:183:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 24+ messages in thread
* [nfs:testing 41/50] fs/nfs/nfs42proc.c:191:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2015-06-24 15:00 kbuild test robot
  2015-06-24 15:00 ` [PATCH] fix ptr_ret.cocci warnings kbuild test robot
  0 siblings, 1 reply; 24+ messages in thread
From: kbuild test robot @ 2015-06-24 15:00 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: kbuild-all, Jeff Layton, Peng Tao, linux-nfs

tree:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git testing
head:   f890ffcf683f2bf8d90f2a4918041f8988ccfbbe
commit: be3a5d233922d73f27002ce2767f6ec03c3f473d [41/50] NFSv.2/pnfs Add a LAYOUTSTATS rpc function


coccinelle warnings: (new ones prefixed by >>)

>> fs/nfs/nfs42proc.c:191:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2020-08-27  1:41 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15 10:52 [PATCH] fix ptr_ret.cocci warnings Julia Lawall
2017-05-15 10:56 ` Stephan Müller
  -- strict thread matches above, loose matches on Subject: below --
2020-08-27  1:41 [ebiggers:cryptobench 1/1] crypto/benchmark.c:616:1-3: WARNING: PTR_ERR_OR_ZERO can be used kernel test robot
2020-08-27  1:41 ` [PATCH] fix ptr_ret.cocci warnings kernel test robot
2019-12-21  1:18 drivers/pci/controller/pcie-rockchip-host.c:628:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2019-12-21  1:18 ` [PATCH] fix ptr_ret.cocci warnings kbuild test robot
2019-12-21  1:18   ` kbuild test robot
2019-12-21  1:18   ` kbuild test robot
2019-10-09 11:32 [wsa:renesas/i2c/new_dummy 5/5] drivers/i2c/busses/i2c-nvidia-gpu.c:284:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2019-10-09 11:32 ` [PATCH] fix ptr_ret.cocci warnings kbuild test robot
2018-10-24 19:58 [PATCH v2 10/13] NFS inter ssc open Olga Kornievskaia
2018-10-25  1:31 ` [PATCH] fix ptr_ret.cocci warnings kbuild test robot
2017-03-17 14:48 [PATCH v8 3/3] backlight arcxcnn add support for ArcticSand devices kbuild test robot
2017-03-15 19:45 ` Olimpiu Dejeu
2017-03-17 14:48   ` [PATCH] fix ptr_ret.cocci warnings kbuild test robot
2017-03-17 14:48     ` kbuild test robot
2017-03-17 14:48     ` kbuild test robot
2017-03-21 14:58     ` Olimpiu Dejeu
2017-03-21 14:58       ` Olimpiu Dejeu
2017-03-21 14:58       ` Olimpiu Dejeu
2017-03-21 15:07       ` Daniel Thompson
2017-03-21 15:07         ` Daniel Thompson
2017-03-21 15:07         ` Daniel Thompson
2017-04-17 12:57         ` Olimpiu Dejeu
2017-04-24 10:57           ` Lee Jones
2017-04-24 10:57             ` Lee Jones
2017-04-24 10:57             ` Lee Jones
2017-04-24 11:26             ` Daniel Thompson
2017-04-24 11:26               ` Daniel Thompson
2015-06-24 15:00 [nfs:testing 41/50] fs/nfs/nfs42proc.c:191:1-3: WARNING: PTR_ERR_OR_ZERO can be used kbuild test robot
2015-06-24 15:00 ` [PATCH] fix ptr_ret.cocci warnings kbuild test robot

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.