On Mon, Jun 06, 2022 at 04:10:42PM +0200, Oleksandr Natalenko wrote:
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1504 for (vma =
> > mm->mmap; vma; vma = vma->vm_next) {
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1505 switch
> > (behaviour) {
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1506
> > case MADV_MERGEABLE:
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1507
> > ret = ksm_madvise_merge(vma->vm_mm, vma, &vma->vm_flags);
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1508
> > break;
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1509
> > case MADV_UNMERGEABLE:
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1510
> > ret = ksm_madvise_unmerge(vma, vma->vm_start, vma->vm_end,
> > &vma->vm_flags);
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1511
> > break;
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1512
> > default:
> > 930581120060a7 Oleksandr Natalenko 2021-10-04 1513
> > /* look, ma, no brain */
> >
> > ret = -EINVAL;?
>
> I think whatever performs this check and complains is overly cautious because
> given 1464–1472 `switch` block the value of `behaviour` cannot be anything
> else other than `MADV_MERGEABLE | MADV_UNMERGEABLE`, hence `default` branch
> will never be taken.
>
> I can add this "fix", of course, to shut up the checker, but it doesn't make
> much sense from my PoV.
>
> A more reasonable thing to do is to remove `default` branch. Is this
> something that can be tested by the test suite?
>
You know what, I should have just looked at the date and ignored this.
My own test system does not complain about this, because it has cross
function information so it knows that default is impossible.
My bad. Just ignore this. To human reading this code it's pretty clear
from the comments that the default path is just about silencing static
checker warnings.
regards,
dan carpenter
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]