public inbox for smatch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] check_all_func_returns: Fix a test against "vfprintf"
@ 2022-05-26  9:33 Christophe JAILLET
  2022-05-26 11:56 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-05-26  9:33 UTC (permalink / raw)
  To: smatch; +Cc: Christophe JAILLET

It is likely that a "== 0" is missing here, or the "if" will be always
true. In such a case, it would be easier to remove it altogether.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Speculative. Un-tested.
---
 check_all_func_returns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/check_all_func_returns.c b/check_all_func_returns.c
index 1ff50433d57b..bd87e1adbc7a 100644
--- a/check_all_func_returns.c
+++ b/check_all_func_returns.c
@@ -55,7 +55,7 @@ static void check_func_return(struct expression *expr)
 	if (strcmp(func, "printf") == 0 || strcmp(func, "vprintf") == 0)
 		return;
 
-	if (strcmp(func, "fprintf") == 0 || strcmp(func, "vfprintf")) {
+	if (strcmp(func, "fprintf") == 0 || strcmp(func, "vfprintf") == 0) {
 		const char *arg0 = expr_to_str(get_argument_from_call_expr(expr->args, 0));
 
 		if (arg0 != NULL &&
-- 
2.34.1

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

* Re: [PATCH] check_all_func_returns: Fix a test against "vfprintf"
  2022-05-26  9:33 [PATCH] check_all_func_returns: Fix a test against "vfprintf" Christophe JAILLET
@ 2022-05-26 11:56 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2022-05-26 11:56 UTC (permalink / raw)
  To: Christophe JAILLET, John Levon; +Cc: smatch

On Thu, May 26, 2022 at 11:33:30AM +0200, Christophe JAILLET wrote:
> It is likely that a "== 0" is missing here, or the "if" will be always
> true. In such a case, it would be easier to remove it altogether.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Speculative. Un-tested.

Looks correct.  Applied.  This is for illumos, so I've added John to the
CC list.

regards,
dan carpenter

> ---
>  check_all_func_returns.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/check_all_func_returns.c b/check_all_func_returns.c
> index 1ff50433d57b..bd87e1adbc7a 100644
> --- a/check_all_func_returns.c
> +++ b/check_all_func_returns.c
> @@ -55,7 +55,7 @@ static void check_func_return(struct expression *expr)
>  	if (strcmp(func, "printf") == 0 || strcmp(func, "vprintf") == 0)
>  		return;
>  
> -	if (strcmp(func, "fprintf") == 0 || strcmp(func, "vfprintf")) {
> +	if (strcmp(func, "fprintf") == 0 || strcmp(func, "vfprintf") == 0) {
>  		const char *arg0 = expr_to_str(get_argument_from_call_expr(expr->args, 0));
>  
>  		if (arg0 != NULL &&
> -- 
> 2.34.1

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

end of thread, other threads:[~2022-05-26 11:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-26  9:33 [PATCH] check_all_func_returns: Fix a test against "vfprintf" Christophe JAILLET
2022-05-26 11:56 ` Dan Carpenter

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