* ida_alloc_range() check question
@ 2026-01-10 21:06 Harshit Mogalapalli
2026-01-22 11:15 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Harshit Mogalapalli @ 2026-01-10 21:06 UTC (permalink / raw)
To: smatch, Marion & Christophe JAILLET, Dan Carpenter
Hi,
I have seen this warning on linux-next:
drivers/pci/ide.c:42 reserve_stream_index() error: Calling
ida_alloc_range() with a 'max' argument which is a power of 2. -1 missing?
I was wondering if it would be reasonable to skip when min is not zero ?
diff --git a/check_ida_alloc.c b/check_ida_alloc.c
index e29b8ff1b28c..e6374dd31683 100644
--- a/check_ida_alloc.c
+++ b/check_ida_alloc.c
@@ -74,21 +74,21 @@ static void match_ida_alloc_max(const char *fn,
struct expression *expr, void *_
static void match_ida_alloc_range(const char *fn, struct expression
*expr, void *info)
{
struct expression *arg_expr1, *arg_expr2;
sval_t sval;
arg_expr1 = get_argument_from_call_expr(expr->args, 1);
arg_expr1 = strip_expr(arg_expr1);
arg_expr2 = get_argument_from_call_expr(expr->args, 2);
arg_expr2 = strip_expr(arg_expr2);
if (!get_implied_value(arg_expr1, &sval))
return;
- if (sval.uvalue == 1)
+ if (sval.uvalue != 0)
return;
if (is_power_of_two(arg_expr2))
sm_error("Calling %s() with a 'max' argument which is a
power of 2. -1 missing?",
fn);
}
This wouldn't still help silencing warning in this case, but maybe help
reduce FPs ? Thoughts ?
Thanks,
Harshit
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: ida_alloc_range() check question
2026-01-10 21:06 ida_alloc_range() check question Harshit Mogalapalli
@ 2026-01-22 11:15 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-01-22 11:15 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: smatch, Marion & Christophe JAILLET, Dan Carpenter
Harshit sent me private email to ignore so I did. But he meant to ignore
a different copy of this email...
On Sun, Jan 11, 2026 at 02:36:04AM +0530, Harshit Mogalapalli wrote:
> Hi,
>
>
> I have seen this warning on linux-next:
> drivers/pci/ide.c:42 reserve_stream_index() error: Calling ida_alloc_range()
> with a 'max' argument which is a power of 2. -1 missing?
>
> I was wondering if it would be reasonable to skip when min is not zero ?
>
I don't get a warning in drivers/pci/ide.c. I don't see how it triggers
a warning for you. I'm on linux next.
I reviewed the other 5 warnings and they all seem like real bugs. I
should update the inline warnings to be a better format, but I can't
promise when that will happen.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-22 11:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-10 21:06 ida_alloc_range() check question Harshit Mogalapalli
2026-01-22 11:15 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox