public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipmi: Remove incorrect use of seq_has_overflowed
@ 2015-02-22 18:21 Joe Perches
  2015-02-23 15:02 ` Corey Minyard
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2015-02-22 18:21 UTC (permalink / raw)
  To: Corey Minyard; +Cc: LKML

commit d6c5dc18d863 ("ipmi: Remove uses of return value of seq_printf")
incorrectly changed the return value of various proc_show functions
to use seq_has_overflowed().

These functions should return 0 on completion rather than 1/true
on overflow.  1 is the same as #define SEQ_SKIP which would cause
the output to not be emitted (skipped) instead.

This is a logical defect only as the length of these outputs are
all smaller than the initial allocation done by the seq filesystem.

Signed-off-by: Joe Perches <joe@perches.com>
---

apologies for stuffing this up the first time.

 drivers/char/ipmi/ipmi_msghandler.c | 4 ++--
 drivers/char/ipmi/ipmi_si_intf.c    | 4 ++--
 drivers/char/ipmi/ipmi_ssif.c       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 9bb5928..bf75f63 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2000,7 +2000,7 @@ static int smi_ipmb_proc_show(struct seq_file *m, void *v)
 		seq_printf(m, " %x", intf->channels[i].address);
 	seq_putc(m, '\n');
 
-	return seq_has_overflowed(m);
+	return 0;
 }
 
 static int smi_ipmb_proc_open(struct inode *inode, struct file *file)
@@ -2023,7 +2023,7 @@ static int smi_version_proc_show(struct seq_file *m, void *v)
 		   ipmi_version_major(&intf->bmc->id),
 		   ipmi_version_minor(&intf->bmc->id));
 
-	return seq_has_overflowed(m);
+	return 0;
 }
 
 static int smi_version_proc_open(struct inode *inode, struct file *file)
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index f6646ed..003b4c1 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2987,7 +2987,7 @@ static int smi_type_proc_show(struct seq_file *m, void *v)
 
 	seq_printf(m, "%s\n", si_to_str[smi->si_type]);
 
-	return seq_has_overflowed(m);
+	return 0;
 }
 
 static int smi_type_proc_open(struct inode *inode, struct file *file)
@@ -3060,7 +3060,7 @@ static int smi_params_proc_show(struct seq_file *m, void *v)
 		   smi->irq,
 		   smi->slave_addr);
 
-	return seq_has_overflowed(m);
+	return 0;
 }
 
 static int smi_params_proc_open(struct inode *inode, struct file *file)
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index f6e378d..40ae7f2 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1198,7 +1198,7 @@ static int smi_type_proc_show(struct seq_file *m, void *v)
 {
 	seq_puts(m, "ssif\n");
 
-	return seq_has_overflowed(m);
+	return 0;
 }
 
 static int smi_type_proc_open(struct inode *inode, struct file *file)



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

* Re: [PATCH] ipmi: Remove incorrect use of seq_has_overflowed
  2015-02-22 18:21 [PATCH] ipmi: Remove incorrect use of seq_has_overflowed Joe Perches
@ 2015-02-23 15:02 ` Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2015-02-23 15:02 UTC (permalink / raw)
  To: Joe Perches; +Cc: LKML

Ok, this looks correct.  I'll probably target this for the rc2 release,
along with anything else that comes along.

Thanks,

-corey

On 02/22/2015 12:21 PM, Joe Perches wrote:
> commit d6c5dc18d863 ("ipmi: Remove uses of return value of seq_printf")
> incorrectly changed the return value of various proc_show functions
> to use seq_has_overflowed().
>
> These functions should return 0 on completion rather than 1/true
> on overflow.  1 is the same as #define SEQ_SKIP which would cause
> the output to not be emitted (skipped) instead.
>
> This is a logical defect only as the length of these outputs are
> all smaller than the initial allocation done by the seq filesystem.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>
> apologies for stuffing this up the first time.
>
>  drivers/char/ipmi/ipmi_msghandler.c | 4 ++--
>  drivers/char/ipmi/ipmi_si_intf.c    | 4 ++--
>  drivers/char/ipmi/ipmi_ssif.c       | 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> index 9bb5928..bf75f63 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -2000,7 +2000,7 @@ static int smi_ipmb_proc_show(struct seq_file *m, void *v)
>  		seq_printf(m, " %x", intf->channels[i].address);
>  	seq_putc(m, '\n');
>  
> -	return seq_has_overflowed(m);
> +	return 0;
>  }
>  
>  static int smi_ipmb_proc_open(struct inode *inode, struct file *file)
> @@ -2023,7 +2023,7 @@ static int smi_version_proc_show(struct seq_file *m, void *v)
>  		   ipmi_version_major(&intf->bmc->id),
>  		   ipmi_version_minor(&intf->bmc->id));
>  
> -	return seq_has_overflowed(m);
> +	return 0;
>  }
>  
>  static int smi_version_proc_open(struct inode *inode, struct file *file)
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
> index f6646ed..003b4c1 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -2987,7 +2987,7 @@ static int smi_type_proc_show(struct seq_file *m, void *v)
>  
>  	seq_printf(m, "%s\n", si_to_str[smi->si_type]);
>  
> -	return seq_has_overflowed(m);
> +	return 0;
>  }
>  
>  static int smi_type_proc_open(struct inode *inode, struct file *file)
> @@ -3060,7 +3060,7 @@ static int smi_params_proc_show(struct seq_file *m, void *v)
>  		   smi->irq,
>  		   smi->slave_addr);
>  
> -	return seq_has_overflowed(m);
> +	return 0;
>  }
>  
>  static int smi_params_proc_open(struct inode *inode, struct file *file)
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index f6e378d..40ae7f2 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -1198,7 +1198,7 @@ static int smi_type_proc_show(struct seq_file *m, void *v)
>  {
>  	seq_puts(m, "ssif\n");
>  
> -	return seq_has_overflowed(m);
> +	return 0;
>  }
>  
>  static int smi_type_proc_open(struct inode *inode, struct file *file)
>
>


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

end of thread, other threads:[~2015-02-23 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-22 18:21 [PATCH] ipmi: Remove incorrect use of seq_has_overflowed Joe Perches
2015-02-23 15:02 ` Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox