[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6621335c-b099-43f3-8c4e-eff7dfec57ac@icloud.com>
Date: Fri, 25 Apr 2025 19:21:16 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Jani Nikula <jani.nikula@...ux.intel.com>,
Antonino Daplas <adaplas@...il.com>, Helge Deller <deller@....de>
Cc: linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH] fbdev/nvidiafb: Correct const string length in
nvidiafb_setup()
On 2025/4/25 16:55, Jani Nikula wrote:
>> } else if (!strncmp(this_opt, "noscale", 7)) {
>> noscale = 1;
> A further cleanup could be to replace all of the strncmp's with
> str_has_prefix(this_opt, "...") to avoid this class of errors
> altogether. It also returns the length of the prefix on match, and that
> can be used to drop more magic numbers.
very agree with your point. may use strstarts().
there are many strncmp() usages with long const string and hardcoded
string length. some usages are wrong.
Powered by blists - more mailing lists