Possible bug?
Lucas De Marchi
lucas.demarchi at intel.com
Wed Nov 12 06:57:46 PST 2025
On Tue, Nov 11, 2025 at 10:58:03AM +0000, Usyskin, Alexander wrote:
>> >> >
>> >> >It's probably due to struct intel_dg_nvm regions[] member being
>> >> >__counted_by(nregions) but regions[] is indexed before nregions has
>> been
>> >> >initialized.
>> >>
>> >> yeah... and we shouldn't silently continue hiding the ENOMEM... Sasha,
>> >> something like this?
>> >>
>> >
>> > In general, looks good for me, but I see that we can fill less entries because
>> of
>> > if (!invm->regions[i].name)
>> > continue;
>> >
>> > Let's leave 'nvm->nregions = n;' in place, only need to fix the comment.
>>
>> You have this in place, nregions already accouns for them:
>>
>> /* count available regions */
>> for (nregions = 0, i = 0; i < INTEL_DG_NVM_REGIONS; i++) {
>> if (invm->regions[i].name)
>> nregions++;
>> }
>>
>
>Yeah, missed this, so original fix from Lucas is ok
I submitted it as a proper patch with commit message:
https://lore.kernel.org/all/20251111-mtd-nregions-v1-1-61db61e78c63@intel.com/
Lucas De Marchi
More information about the linux-mtd
mailing list