All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] um: Use common error handling code in port_listen_fd()
@ 2017-10-20 17:29 ` SF Markus Elfring
  0 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-20 17:29 UTC (permalink / raw)
  To: user-mode-linux-devel, Jeff Dike, Richard Weinberger
  Cc: user-mode-linux-user, kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Oct 2017 19:24:39 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/um/drivers/port_user.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index 9a8e1b64c22e..8d95fa5641af 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -118,29 +118,24 @@ int port_listen_fd(int port)
 		return -errno;
 
 	arg = 1;
-	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0) {
-		err = -errno;
-		goto out;
-	}
+	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0)
+		goto failure_indication;
 
 	addr.sin_family = AF_INET;
 	addr.sin_port = htons(port);
 	addr.sin_addr.s_addr = htonl(INADDR_ANY);
-	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
-		err = -errno;
-		goto out;
-	}
-
-	if (listen(fd, 1) < 0) {
-		err = -errno;
-		goto out;
-	}
+	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0 ||
+	    listen(fd, 1) < 0)
+		goto failure_indication;
 
 	err = os_set_fd_block(fd, 0);
 	if (err < 0)
 		goto out;
 
 	return fd;
+
+ failure_indication:
+	err = -errno;
  out:
 	close(fd);
 	return err;
-- 
2.14.2

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

* [PATCH] um: Use common error handling code in port_listen_fd()
@ 2017-10-20 17:29 ` SF Markus Elfring
  0 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-20 17:29 UTC (permalink / raw)
  To: user-mode-linux-devel, Jeff Dike, Richard Weinberger
  Cc: user-mode-linux-user, kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Oct 2017 19:24:39 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/um/drivers/port_user.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index 9a8e1b64c22e..8d95fa5641af 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -118,29 +118,24 @@ int port_listen_fd(int port)
 		return -errno;
 
 	arg = 1;
-	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0) {
-		err = -errno;
-		goto out;
-	}
+	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &arg, sizeof(arg)) < 0)
+		goto failure_indication;
 
 	addr.sin_family = AF_INET;
 	addr.sin_port = htons(port);
 	addr.sin_addr.s_addr = htonl(INADDR_ANY);
-	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
-		err = -errno;
-		goto out;
-	}
-
-	if (listen(fd, 1) < 0) {
-		err = -errno;
-		goto out;
-	}
+	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0 ||
+	    listen(fd, 1) < 0)
+		goto failure_indication;
 
 	err = os_set_fd_block(fd, 0);
 	if (err < 0)
 		goto out;
 
 	return fd;
+
+ failure_indication:
+	err = -errno;
  out:
 	close(fd);
 	return err;
-- 
2.14.2


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

* Re: [PATCH] um: Use common error handling code in port_listen_fd()
  2017-10-20 17:29 ` SF Markus Elfring
@ 2017-10-20 18:06   ` Joe Perches
  -1 siblings, 0 replies; 18+ messages in thread
From: Joe Perches @ 2017-10-20 18:06 UTC (permalink / raw)
  To: SF Markus Elfring, user-mode-linux-devel, Jeff Dike, Richard Weinberger
  Cc: user-mode-linux-user, kernel-janitors, LKML

On Fri, 2017-10-20 at 19:29 +0200, SF Markus Elfring wrote:
> arch/um/drivers/port_user.c

If you are going to use multiple labels,
it'd be nicer to rename out: too.

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

* Re: [PATCH] um: Use common error handling code in port_listen_fd()
@ 2017-10-20 18:06   ` Joe Perches
  0 siblings, 0 replies; 18+ messages in thread
From: Joe Perches @ 2017-10-20 18:06 UTC (permalink / raw)
  To: SF Markus Elfring, user-mode-linux-devel, Jeff Dike, Richard Weinberger
  Cc: user-mode-linux-user, kernel-janitors, LKML

On Fri, 2017-10-20 at 19:29 +0200, SF Markus Elfring wrote:
> arch/um/drivers/port_user.c

If you are going to use multiple labels,
it'd be nicer to rename out: too.


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

* Re: um: Use common error handling code in port_listen_fd()
  2017-10-20 18:06   ` Joe Perches
@ 2017-10-20 18:22     ` SF Markus Elfring
  -1 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-20 18:22 UTC (permalink / raw)
  To: Joe Perches, user-mode-linux-devel
  Cc: Jeff Dike, Richard Weinberger, user-mode-linux-user,
	kernel-janitors, LKML

> If you are going to use multiple labels,
> it'd be nicer to rename out: too.

Thanks for your suggestion.

I left this place untouched because such kind of renaming seemed to be unwanted
in some software areas for a while.
How long should I wait for corresponding feedback before another small
source code adjustment will be appropriate?

Regards,
Markus

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

* Re: um: Use common error handling code in port_listen_fd()
@ 2017-10-20 18:22     ` SF Markus Elfring
  0 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-20 18:22 UTC (permalink / raw)
  To: Joe Perches, user-mode-linux-devel
  Cc: Jeff Dike, Richard Weinberger, user-mode-linux-user,
	kernel-janitors, LKML

> If you are going to use multiple labels,
> it'd be nicer to rename out: too.

Thanks for your suggestion.

I left this place untouched because such kind of renaming seemed to be unwanted
in some software areas for a while.
How long should I wait for corresponding feedback before another small
source code adjustment will be appropriate?

Regards,
Markus

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

* Re: [PATCH] um: Use common error handling code in port_listen_fd()
  2017-10-20 17:29 ` SF Markus Elfring
@ 2017-10-23  8:48   ` Dan Carpenter
  -1 siblings, 0 replies; 18+ messages in thread
From: Dan Carpenter @ 2017-10-23  8:48 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: user-mode-linux-devel, Jeff Dike, Richard Weinberger,
	user-mode-linux-user, kernel-janitors, LKML

This business of moving the error code to the bottom of the function
just makes the code less readable.  I know you never listen to anyone,
but you should stop doing it.

regards,
dan carpenter

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

* Re: [PATCH] um: Use common error handling code in port_listen_fd()
@ 2017-10-23  8:48   ` Dan Carpenter
  0 siblings, 0 replies; 18+ messages in thread
From: Dan Carpenter @ 2017-10-23  8:48 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: user-mode-linux-devel, Jeff Dike, Richard Weinberger,
	user-mode-linux-user, kernel-janitors, LKML

This business of moving the error code to the bottom of the function
just makes the code less readable.  I know you never listen to anyone,
but you should stop doing it.

regards,
dan carpenter


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

* Re: um: Use common error handling code in port_listen_fd()
  2017-10-23  8:48   ` Dan Carpenter
@ 2017-10-23  9:01     ` SF Markus Elfring
  -1 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-23  9:01 UTC (permalink / raw)
  To: Dan Carpenter, user-mode-linux-devel
  Cc: Jeff Dike, Richard Weinberger, user-mode-linux-user,
	kernel-janitors, LKML

> This business of moving the error code to the bottom of the function
> just makes the code less readable.

I got an other software development opinion on this aspect.
Could you become used to the proposed control flow structure
in the affected function?


> I know you never listen to anyone,

My response times might not fir to your preferences.


> but you should stop doing it.

I am going to offer suggestions for change patterns which I find useful.
There are some challenges around change acceptance as usual.

Regards,
Markus

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

* Re: um: Use common error handling code in port_listen_fd()
@ 2017-10-23  9:01     ` SF Markus Elfring
  0 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-23  9:01 UTC (permalink / raw)
  To: Dan Carpenter, user-mode-linux-devel
  Cc: Jeff Dike, Richard Weinberger, user-mode-linux-user,
	kernel-janitors, LKML

> This business of moving the error code to the bottom of the function
> just makes the code less readable.

I got an other software development opinion on this aspect.
Could you become used to the proposed control flow structure
in the affected function?


> I know you never listen to anyone,

My response times might not fir to your preferences.


> but you should stop doing it.

I am going to offer suggestions for change patterns which I find useful.
There are some challenges around change acceptance as usual.

Regards,
Markus

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

* Re: um: Use common error handling code in port_listen_fd()
  2017-10-23  9:01     ` SF Markus Elfring
@ 2017-10-23  9:10       ` Dan Carpenter
  -1 siblings, 0 replies; 18+ messages in thread
From: Dan Carpenter @ 2017-10-23  9:10 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: user-mode-linux-devel, Jeff Dike, Richard Weinberger,
	user-mode-linux-user, kernel-janitors, LKML

On Mon, Oct 23, 2017 at 11:01:05AM +0200, SF Markus Elfring wrote:
> > This business of moving the error code to the bottom of the function
> > just makes the code less readable.
> 
> I got an other software development opinion on this aspect.
> Could you become used to the proposed control flow structure
> in the affected function?
> 

No.  Don't do this.  It's pointless obfuscation.

> 
> > I know you never listen to anyone,
> 
> My response times might not fir to your preferences.
> 
> 
> > but you should stop doing it.
> 
> I am going to offer suggestions for change patterns which I find useful.
> There are some challenges around change acceptance as usual.

Yeah.  I knew it was pointless to ask you to stop this...  :(

regards,
dan carpenter

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

* Re: um: Use common error handling code in port_listen_fd()
@ 2017-10-23  9:10       ` Dan Carpenter
  0 siblings, 0 replies; 18+ messages in thread
From: Dan Carpenter @ 2017-10-23  9:10 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: user-mode-linux-devel, Jeff Dike, Richard Weinberger,
	user-mode-linux-user, kernel-janitors, LKML

On Mon, Oct 23, 2017 at 11:01:05AM +0200, SF Markus Elfring wrote:
> > This business of moving the error code to the bottom of the function
> > just makes the code less readable.
> 
> I got an other software development opinion on this aspect.
> Could you become used to the proposed control flow structure
> in the affected function?
> 

No.  Don't do this.  It's pointless obfuscation.

> 
> > I know you never listen to anyone,
> 
> My response times might not fir to your preferences.
> 
> 
> > but you should stop doing it.
> 
> I am going to offer suggestions for change patterns which I find useful.
> There are some challenges around change acceptance as usual.

Yeah.  I knew it was pointless to ask you to stop this...  :(

regards,
dan carpenter


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

* Re: um: Use common error handling code in port_listen_fd()
  2017-10-23  9:10       ` Dan Carpenter
@ 2017-10-23  9:17         ` SF Markus Elfring
  -1 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-23  9:17 UTC (permalink / raw)
  To: Dan Carpenter, user-mode-linux-devel
  Cc: Jeff Dike, Richard Weinberger, user-mode-linux-user,
	kernel-janitors, LKML

>> Could you become used to the proposed control flow structure
>> in the affected function?
>>
> 
> No.  Don't do this.

Thanks for your information.


> It's pointless obfuscation.

I disagree for this view.


>> There are some challenges around change acceptance as usual.
> 
> Yeah.  I knew it was pointless to ask you to stop this...  :(

The mixture of agreements and disagreements will evolve over time, won't they?

Regards,
Markus

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

* Re: um: Use common error handling code in port_listen_fd()
@ 2017-10-23  9:17         ` SF Markus Elfring
  0 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-23  9:17 UTC (permalink / raw)
  To: Dan Carpenter, user-mode-linux-devel
  Cc: Jeff Dike, Richard Weinberger, user-mode-linux-user,
	kernel-janitors, LKML

>> Could you become used to the proposed control flow structure
>> in the affected function?
>>
> 
> No.  Don't do this.

Thanks for your information.


> It's pointless obfuscation.

I disagree for this view.


>> There are some challenges around change acceptance as usual.
> 
> Yeah.  I knew it was pointless to ask you to stop this...  :(

The mixture of agreements and disagreements will evolve over time, won't they?

Regards,
Markus

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

* Re: [PATCH] um: Use common error handling code in port_listen_fd()
  2017-10-23  8:48   ` Dan Carpenter
@ 2017-10-23 10:28     ` Markus Trippelsdorf
  -1 siblings, 0 replies; 18+ messages in thread
From: Markus Trippelsdorf @ 2017-10-23 10:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: SF Markus Elfring, user-mode-linux-devel, Jeff Dike,
	Richard Weinberger, user-mode-linux-user, kernel-janitors, LKML,
	David Miller, Linus Torvalds, Alexander Viro

On 2017.10.23 at 11:48 +0300, Dan Carpenter wrote:
> This business of moving the error code to the bottom of the function
> just makes the code less readable.  I know you never listen to anyone,
> but you should stop doing it.

How long have we to put up with this?
He just keeps sending these crap patches without listening to anybody,
thereby wasting valuable developer time.

Even browsing LKML is no fun anymore, because his endless mindless patch
series drags everything down qualitywise.

David, would it be possible to simply ban him (SF Markus Elfring) from
vger.kernel.org?

-- 
Markus

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

* Re: [PATCH] um: Use common error handling code in port_listen_fd()
@ 2017-10-23 10:28     ` Markus Trippelsdorf
  0 siblings, 0 replies; 18+ messages in thread
From: Markus Trippelsdorf @ 2017-10-23 10:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: SF Markus Elfring, user-mode-linux-devel, Jeff Dike,
	Richard Weinberger, user-mode-linux-user, kernel-janitors, LKML,
	David Miller, Linus Torvalds, Alexander Viro

On 2017.10.23 at 11:48 +0300, Dan Carpenter wrote:
> This business of moving the error code to the bottom of the function
> just makes the code less readable.  I know you never listen to anyone,
> but you should stop doing it.

How long have we to put up with this?
He just keeps sending these crap patches without listening to anybody,
thereby wasting valuable developer time.

Even browsing LKML is no fun anymore, because his endless mindless patch
series drags everything down qualitywise.

David, would it be possible to simply ban him (SF Markus Elfring) from
vger.kernel.org?

-- 
Markus

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

* Re: um: Use common error handling code in port_listen_fd()
  2017-10-23 10:28     ` Markus Trippelsdorf
@ 2017-10-23 12:04       ` SF Markus Elfring
  -1 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-23 12:04 UTC (permalink / raw)
  To: Markus Trippelsdorf, user-mode-linux-devel
  Cc: Dan Carpenter, Jeff Dike, Richard Weinberger,
	user-mode-linux-user, kernel-janitors, LKML, David Miller,
	Linus Torvalds, Alexander Viro

> He just keeps sending these crap patches without listening to anybody,

I am listening. - But this does not automatically mean that we come to
the same thoughts and conclusions on some topics.


> thereby wasting valuable developer time.

There are also contributors who respond in a positive way
(while you might not like a specific change so far).


> Even browsing LKML is no fun anymore,

It can be very challenging as the communication traffic is evolving.


> because his endless mindless patch series drags everything down qualitywise.

This is a pity that you interpret my different contributions
into such a direction.


> David, would it be possible to simply ban him (SF Markus Elfring)
> from vger.kernel.org?

Do you really prefer censorship over free speech in this case?

Regards,
Markus

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

* Re: um: Use common error handling code in port_listen_fd()
@ 2017-10-23 12:04       ` SF Markus Elfring
  0 siblings, 0 replies; 18+ messages in thread
From: SF Markus Elfring @ 2017-10-23 12:04 UTC (permalink / raw)
  To: Markus Trippelsdorf, user-mode-linux-devel
  Cc: Dan Carpenter, Jeff Dike, Richard Weinberger,
	user-mode-linux-user, kernel-janitors, LKML, David Miller,
	Linus Torvalds, Alexander Viro

> He just keeps sending these crap patches without listening to anybody,

I am listening. - But this does not automatically mean that we come to
the same thoughts and conclusions on some topics.


> thereby wasting valuable developer time.

There are also contributors who respond in a positive way
(while you might not like a specific change so far).


> Even browsing LKML is no fun anymore,

It can be very challenging as the communication traffic is evolving.


> because his endless mindless patch series drags everything down qualitywise.

This is a pity that you interpret my different contributions
into such a direction.


> David, would it be possible to simply ban him (SF Markus Elfring)
> from vger.kernel.org?

Do you really prefer censorship over free speech in this case?

Regards,
Markus

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

end of thread, other threads:[~2017-10-23 12:05 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20 17:29 [PATCH] um: Use common error handling code in port_listen_fd() SF Markus Elfring
2017-10-20 17:29 ` SF Markus Elfring
2017-10-20 18:06 ` Joe Perches
2017-10-20 18:06   ` Joe Perches
2017-10-20 18:22   ` SF Markus Elfring
2017-10-20 18:22     ` SF Markus Elfring
2017-10-23  8:48 ` [PATCH] " Dan Carpenter
2017-10-23  8:48   ` Dan Carpenter
2017-10-23  9:01   ` SF Markus Elfring
2017-10-23  9:01     ` SF Markus Elfring
2017-10-23  9:10     ` Dan Carpenter
2017-10-23  9:10       ` Dan Carpenter
2017-10-23  9:17       ` SF Markus Elfring
2017-10-23  9:17         ` SF Markus Elfring
2017-10-23 10:28   ` [PATCH] " Markus Trippelsdorf
2017-10-23 10:28     ` Markus Trippelsdorf
2017-10-23 12:04     ` SF Markus Elfring
2017-10-23 12:04       ` SF Markus Elfring

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.