Open Bug 1918432 Opened 8 months ago Updated 7 months ago

impossible case value for switch in mpi.c

Categories

(NSS :: Libraries, defect, P3)

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: jp, Unassigned)

Details

Steps to reproduce:

This is a really minor nit in the mpi.c code in NSS 3.104.

4379 for (ix = a_len; ix >= 4; ix -= 4) {
4380 ADD_SQUARE(0);
4381 ADD_SQUARE(1);
4382 ADD_SQUARE(2);
4383 ADD_SQUARE(3);
4384 pa += 4;
4385 ps += 8;
4386 }
4387 if (ix) {
4388 ps += 2 * ix;
4389 pa += ix;
4390 switch (ix) {
4391 case 3:
4392 ADD_SQUARE(-3); /* FALLTHRU /
4393 case 2:
4394 ADD_SQUARE(-2); /
FALLTHRU /
4395 case 1:
4396 ADD_SQUARE(-1); /
FALLTHRU */
4397 case 0:
4398 break;
4399 }
4400 }

Given the check on line 4390, ix may never be 0 in which case the line 4397 can be removed and the break can join the case for 1. Could be changed to default but it would not change the outcome and is not needed.

Maybe it is on purpose to do it this way but filing it anyway.

This was reported by the parfait static code analyzer.

Severity: -- → S4
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.