[PATCH] fbdev/nvidiafb: Correct const string length in nvidiafb_setup()

Zijun Hu zijun_hu at icloud.com
Fri Apr 25 11:21:16 UTC 2025


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.





More information about the dri-devel mailing list