Project

General

Profile

Bug #807

Analyse Logiscope LFR_3.1.0.4 : Don_Enumeration Severity is Medium

Added by William Recart almost 5 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Low
Category:
-
Target version:
-
Start date:
19/10/2016
Due date:
% Done:

0%

Estimated time:
revision:
r0

Description

Rappel de la règle :
Don_Enumeration
Definition:
-----------
Numbers, characters and strings have to be declared as constants instead of being
used as literals inside a program. The user can list the allowed literal
constants.

Parameters:
-----------
A list of character strings representing the allowed literal constants.

Note: In the case of constants used in initializing lists
(concerning array and struct structures), only the first five violations are shown.

Justification:
--------------
Makes maintenance easier by avoiding the scattering of constants among the code,
often with the same value.

Example:
--------

// do not write

char tab100;
int i;

La règle n'est pas respectée dans 1435 cas d'après Logiscope:
Fichier avf0_prc0.c : lignes 27, 46, 83, 90, 172, 376, 377, 378, 378, 379, 380, 381, 382, 383, 384
Fichier avf1_prc1.c : lignes 28, 84, 91, 173, 368, 369, 370, 370, 371, 372, 373, 374
Fichier avf2_prc2.c : lignes 26, 72, 76, 123, 256, 269, 282
Fichier ccsds_types.h : lignes 303, 304, 305, 311, 313, 314, 323, 324, 325, 331, 333, 334, 335, 348, 349, 350, 356, 358, 359, 360, 363, 372, 373, 374, 380, 382, 383, 384, 395, 396, 397, 403, 405, 406, 407, 418, 419, 420, 426, 428, 429, 430, 433, 434, 435, 436, 444, 445, 446, 452, 460, 461, 469, 470, 471, 477, 483, 484, 492, 493, 494, 500, 508, 509, 517, 518, 519, 525, 531, 533, 541, 542, 543, 549, 555, 556, 564, 565, 566, 572, 580, 581, 582, 587, 592, 593, 594, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 623, 624, 625, 626, 628, 635, 636, 640, 642, 643, 644, 646, 647, 648, 687, 688, 689, 695, 705, 706, 707, 729, 730, 731, 732, 734, 735, 736, 737, 739, 740, 741, 742, 748, 750, 751, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 776, 777, 778, 784, 792
Fichier fsw_config.c : lignes 7, 7, 8, 8, 9, 9
Fichier fsw_globals.c : lignes 26, 27, 28, 98
Fichier fsw_init.c : lignes 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 322, 323, 325, 326, 327, 332, 345, 345, 345, 345, 346, 346, 346, 346, 347, 347, 347, 347, 348, 348, 348, 348, 349, 349, 349, 349, 350, 350, 350, 350, 351, 351, 351, 351, 352, 352, 352, 352, 353, 353, 353, 353, 354, 354, 354, 354, 355, 355, 355, 355, 356, 356, 356, 356, 357, 357, 357, 357, 358, 358, 358, 358, 359, 359, 359, 359, 360, 360, 360, 360, 361, 361, 361, 361, 362, 362, 362, 362, 363, 363, 363, 363, 366, 366, 366, 366, 368, 368, 368, 368, 369, 369, 369, 369, 370, 370, 370, 370, 371, 371, 371, 371, 372, 372, 372, 372, 374, 374, 374, 374, 406, 449, 465, 481, 831, 831, 831, 831, 843, 843, 843, 843, 855, 855, 855, 855, 867, 867, 867, 867, 879, 879, 879, 879, 916, 917, 918, 919
Fichier fsw_init.h : lignes 19, 20
Fichier fsw_misc.c : lignes 28, 48, 49, 50, 51, 52, 64, 65, 66, 130, 144, 145, 146, 147, 193, 193, 193, 193, 213, 220, 264, 264, 272, 287, 291, 292, 293, 293, 294, 295, 295, 296, 354, 354, 355, 356, 357, 358, 380, 382, 386, 390, 394, 422, 429, 433, 447, 448, 452, 453, 453, 473, 474, 494, 495, 496, 496, 497, 498, 498, 499, 509, 509, 526, 530, 536, 537, 538, 538, 539, 540, 540, 541, 545, 546, 550, 551, 553, 555, 556, 556, 560, 562, 586, 587, 588, 588, 589, 589, 590, 590, 591, 591, 604, 605, 606, 606, 607, 607, 608, 608, 609, 609, 628, 640, 644, 652, 656, 664, 668, 676, 680, 686, 689, 705, 706, 707, 740, 740, 741, 743, 743, 744, 746, 746, 747, 757, 757, 811
Fichier fsw_params.h : lignes 276, 277, 278
Fichier fsw_processing.c : lignes 51, 70, 76, 78, 98, 100, 117, 128, 128, 134, 136, 156, 158, 175, 185, 185, 191, 193, 202, 208, 214, 236, 236, 238, 243, 273, 273, 279, 279, 285, 285, 360, 362, 365, 366, 369, 373, 374, 375, 375, 376, 376, 377, 377, 378, 378, 381, 382, 383, 384, 385, 386, 386, 387, 387, 388, 388, 389, 389, 390, 400, 402, 405, 406, 409, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 480, 514, 521, 521, 522, 522, 523, 523, 524, 524, 530, 531, 531, 532, 533, 533, 534, 534, 535, 535, 536, 584, 585, 605, 606, 607, 608, 609, 610, 611, 612, 613, 616, 617, 618, 619, 669, 669, 692, 699, 700, 702, 719, 723, 728, 731, 732, 733, 782, 783
Fichier fsw_processing.h : lignes 27, 28, 29, 35, 41, 42, 44, 53, 54, 55, 61, 67, 69, 71, 102, 103, 176, 184, 204, 205, 206, 206, 206, 207, 207, 207, 208, 208, 208, 209, 209, 209, 210, 210, 210, 211, 211, 211, 287, 287, 344
Fichier fsw_processing_globals.c : ligne 46
Fichier fsw_spacewire.c : lignes 60, 67, 125, 126, 162, 163, 194, 263, 263, 264, 264, 349, 351, 479, 539, 542, 561, 565, 768, 768, 769, 773, 773, 774, 774, 775, 775, 776, 776, 783, 785, 810, 810, 812, 820, 851, 1010, 1011, 1017, 1018, 1019, 1020, 1021, 1022, 1024, 1026, 1027, 1036, 1040, 1047, 1048, 1049, 1050, 1051, 1052, 1054, 1057, 1058, 1068, 1072, 1073, 1079, 1080, 1081, 1082, 1083, 1084, 1086, 1087, 1088, 1089, 1090, 1091, 1128, 1132, 1153, 1153, 1154, 1154, 1155, 1155, 1156, 1156, 1161, 1166, 1216, 1225, 1228, 1230, 1236, 1238, 1247, 1247, 1248, 1248, 1249, 1249, 1250, 1250, 1302, 1306, 1329, 1329, 1330, 1330, 1331, 1331, 1332, 1332, 1335, 1368, 1378, 1389, 1399, 1402, 1406, 1407, 1408, 1408, 1409, 1410, 1410, 1411, 1415, 1415, 1416, 1416, 1417, 1417, 1418, 1418, 1448, 1458, 1469, 1479, 1482, 1486, 1487, 1488, 1488, 1489, 1490, 1490, 1491, 1495, 1495, 1496, 1496, 1497, 1497, 1498, 1498, 1528, 1537, 1546, 1549, 1553, 1554, 1555, 1555, 1556, 1557, 1557, 1558, 1562, 1562, 1563, 1563, 1564, 1564, 1565, 1565, 1586, 1598
Fichier lfr_cpu_usage_report.c : lignes 95, 103, 104, 110
Fichier tc_acceptance.c : lignes 13, 28, 28, 28, 28, 42, 46, 48, 49, 51, 52, 54, 55, 57, 58, 60, 61, 63, 64, 66, 67, 87, 91, 92, 128, 128, 128, 128, 129, 130, 458, 460
Fichier tc_handler.c : lignes 35, 180, 265, 269, 269, 274, 279, 282, 293, 295, 360, 361, 362, 362, 363, 365, 368, 489, 502, 905, 922, 923, 928, 929, 934, 935, 940, 941, 946, 947, 952, 953, 958, 959, 964, 965, 971, 971, 972, 972, 973, 973, 974, 974, 996, 1013, 1014, 1019, 1020, 1025, 1026, 1031, 1032, 1038, 1038, 1039, 1039, 1322, 1326, 1334, 1338, 1367, 1368, 1369, 1370, 1371, 1371, 1373, 1376, 1378, 1379, 1380, 1381, 1392, 1395, 1396, 1397, 1398, 1400, 1403, 1405, 1406, 1407, 1407, 1411, 1413, 1413, 1414, 1414, 1415, 1415, 1416, 1416, 1417, 1417, 1425, 1429, 1438, 1442, 1451, 1455, 1482, 1488, 1508, 1510, 1514, 1514, 1515, 1515, 1516, 1516, 1517, 1517, 1519, 1521, 1538, 1540, 1544, 1544, 1545, 1545, 1546, 1546, 1547, 1547, 1549, 1551, 1618, 1618, 1626, 1630
Fichier tc_load_dump_parameters.c : lignes 108, 117, 130, 175, 184, 192, 192, 195, 240, 249, 262, 334, 334, 335, 335, 339, 339, 340, 340, 343, 343, 344, 344, 350, 408, 422, 428, 436, 441, 442, 443, 443, 444, 445, 445, 446, 460, 462, 463, 467, 472, 473, 474, 474, 475, 476, 476, 477, 511, 512, 513, 513, 514, 515, 515, 516, 551, 555, 559, 570, 572, 578, 580, 589, 598, 608, 617, 627, 988, 996, 999, 1000, 1023, 1028, 1033, 1034, 1045, 1053, 1056, 1059, 1063, 1064, 1065, 1065, 1073, 1081, 1087, 1091, 1093, 1095, 1101, 1103, 1107, 1107, 1110, 1110, 1113, 1113, 1116, 1116, 1119, 1119, 1122, 1122, 1125, 1128, 1133, 1144, 1167, 1215, 1216, 1217, 1222, 1247, 1247, 1249, 1255, 1255, 1258, 1258, 1266, 1268, 1275, 1275, 1278, 1278, 1317, 1364, 1365, 1383, 1383, 1384, 1384, 1394, 1395, 1413, 1417, 1424, 1425, 1426, 1426, 1427, 1428, 1428, 1429, 1439, 1441, 1443, 1468, 1472, 1473, 1483, 1489, 1490, 1490, 1495, 1496, 1498, 1503, 1504, 1506, 1514, 1514, 1520, 1524, 1531, 1532, 1533, 1533, 1534, 1534, 1535, 1535, 1536, 1536, 1539, 1546, 1548, 1611, 1612, 1616
Fichier tm_lfr_tc_exe.c : lignes 44, 47, 54, 55, 56, 56, 57, 58, 58, 59, 109, 112, 119, 120, 121, 121, 122, 123, 123, 124, 126, 177, 180, 187, 188, 189, 189, 190, 191, 191, 192, 194, 245, 248, 255, 256, 257, 257, 258, 259, 259, 260, 262, 311, 314, 321, 322, 323, 323, 324, 325, 325, 326, 328, 379, 380, 388, 391, 398, 399, 400, 400, 401, 402, 402, 403, 405, 497, 498, 502
Fichier wf_handler.c : lignes 64, 67, 89, 118, 118, 121, 121, 125, 127, 127, 131, 145, 145, 160, 162, 172, 185, 185, 191, 191, 197, 199, 199, 204, 212, 212, 216, 216, 221, 223, 223, 228, 236, 236, 241, 241, 246, 248, 248, 253, 286, 286, 288, 288, 400, 401, 405, 416, 417, 417, 455, 470, 490, 578, 679, 679, 680, 680, 681, 681, 682, 682, 698, 701, 703, 704, 705, 705, 706, 707, 707, 708, 710, 711, 712, 712, 713, 713, 714, 714, 715, 720, 720, 724, 724, 728, 728, 732, 732, 736, 736, 740, 740, 744, 744, 748, 748, 753, 759, 760, 761, 761, 762, 762, 763, 763, 764, 791, 792, 793, 794, 807, 808, 810, 813, 814, 818, 819, 838, 850, 850, 850, 851, 851, 851, 854, 855, 856, 856, 856, 857, 857, 857, 861, 898, 899, 900, 905, 905, 906, 906, 914, 914, 919, 919, 931, 933, 933, 939, 944, 944, 950, 967, 1018, 1029, 1094, 1095, 1096, 1100, 1120, 1120, 1121, 1121, 1122, 1123, 1124, 1124, 1125, 1125, 1144, 1145, 1148, 1149, 1152, 1170, 1173, 1184, 1185, 1185, 1185, 1185, 1185, 1185, 1188, 1208, 1209, 1209, 1209, 1209, 1209, 1209, 1231, 1233, 1292, 1293, 1297
Fichier wf_handler.h : ligne 33

History

#1 Updated by paul leroy over 4 years ago

Autoriser comme constantes littérales:

2
2.
256

avf0_prc0.c

avf1_prc1.c

avf2_prc2.c

fsw_init.c
Les lignes suivantes, qui vont par groupes de 4, proviennent de l'utilisation de la fonction rtems-build_name, je pense qu'on ne peut pas faire autrement sans compliquer inutilement les choses
345, 345, 345, 345, 346, 346, 346, 346, 347, 347, 347, 347, 348, 348, 348, 348, 349, 349, 349, 349, 350, 350, 350, 350, 351, 351, 351, 351, 352, 352, 352, 352, 353, 353, 353, 353, 354, 354, 354, 354, 355, 355, 355, 355, 356, 356, 356, 356, 357, 357, 357, 357, 358, 358, 358, 358, 359, 359, 359, 359, 360, 360, 360, 360, 361, 361, 361, 361, 362, 362, 362, 362, 363, 363, 363, 363, 366, 366, 366, 366, 368, 368, 368, 368, 369, 369, 369, 369, 370, 370, 370, 370, 371, 371, 371, 371, 372, 372, 372, 372, 374, 374, 374, 374, 831, 831, 831, 831, 843, 843, 843, 843, 855, 855, 855, 855, 867, 867, 867, 867, 879, 879, 879, 879

fsw_misc.c
lignes 193, 193, 193, 193 => rtems_build_name
705, 706, 707 => allow 256 as a litteral

fsw_params.h

fsw_processing.c

fsw_processing.h :

fsw_processing_globals.c => Fichier non utilisé, à enlever du dépôt.

fsw_spacewire.c :

lfr_cpu_usage_report.c

tc_acceptance.c

#2 Updated by paul leroy over 4 years ago

tc_handler.c

tc_load_dump_parameters.c

tm_lfr_tc_exe.c

wf_handler.c

wf_handler.h

#3 Updated by William Recart over 4 years ago

Ok pour les rtems_build_name, ils seront considérés comme des faux positifs de l'outil.
Ok pour ajouter les litéraux 0,16 et 256.

Pour le 2, je ne comprends pas bien.
Si je prends l'exemple de Fichier avf0_prc0.c : lignes 90 :
On peux facilement supprimer le 2:
En remplaçant :
ring_node_tab[NB_SM_BEFORE_AVF0-1] = nodeForAveraging;
for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ ) {
nodeForAveraging = nodeForAveraging->previous;
ring_node_tab[NB_SM_BEFORE_AVF0-i] = nodeForAveraging;
}

Par :
for ( i = 1; i < (NB_SM_BEFORE_AVF0); i++ ) {
ring_node_tab[NB_SM_BEFORE_AVF0-i] = nodeForAveraging;
nodeForAveraging = nodeForAveraging->previous;
}
ring_node_tab0 = nodeForAveraging;

#4 Updated by paul leroy over 4 years ago

J'ai corrigé pour le coefficient 2. Normalement, j'ai passé tous les fichiers en revue.

#5 Updated by paul leroy over 4 years ago

  • Status changed from New to Resolved
  • Priority changed from Normal to Low

#6 Updated by William Recart over 4 years ago

Si tu as besoin d'une analyse intermédiaire avant la livraison, pour être sûr, je peux te la faire rapidement.

#7 Updated by William Recart over 4 years ago

  • Status changed from Resolved to In Progress

Vérification effectuée sur le tag 322 (c0603702c8c8).
Analyse faite en acceptant les valeurs 0, 1, 2, 16 et 256. Je vais devoir créer une RFD pour que ces valeurs soient proposées au CNES.

Il reste les erreurs suivantes :
ccsds_types.h : lignes 618, 889
(/) OK, corrigé

fsw_config.c : lignes 8, 9, 10, 11, 12
=> considéré comme un faux positif

fsw_init.c : lignes 347, 347, 347, 347, 348, 348, 348, 348, 349, 349, 349, 349, 350, 350, 350, 350, 351, 351, 351, 351, 352, 352, 352, 352, 353, 353, 353, 353, 354, 354, 354, 354, 355, 355, 355, 355, 356, 356, 356, 356, 357, 357, 357, 357, 358, 358, 358, 358, 359, 359, 359, 359, 360, 360, 360, 360, 361, 361, 361, 361, 362, 362, 362, 362, 363, 363, 363, 363, 364, 364, 364, 364, 365, 365, 365, 365, 368, 368, 368, 368, 370, 370, 370, 370, 371, 371, 371, 371, 372, 372, 372, 372, 373, 373, 373, 373, 374, 374, 374, 374, 376, 376, 376, 376, 836, 836, 836, 836, 848, 848, 848, 848, 860, 860, 860, 860, 872, 872, 872, 872, 884, 884, 884, 884
=> considéré comme des faux positifs, utilisation de la fonction rtems_build_name

fsw_misc.c : lignes 197, 197, 197, 197, 418, 577, 578, 579, 796
=> considéré comme des faux positifs, utilisation de la fonction rtems_build_name

fsw_processing.h : lignes 211, 211, 212, 212, 213, 213, 214, 214, 215, 215
(/) OK, corrigé

fsw_processing_globals.c : ligne 46
(/) OK, corrigé

wf_handler.c : lignes 211, 1170, 1174
(/) OK, corrigé

#8 Updated by bruno katra over 4 years ago

  • Assignee changed from paul leroy to William Recart

#9 Updated by William Recart over 4 years ago

Satus on FSW V3.2.0.15 :
- ccsds_types.h: lines 830, 831, 832, 833, 835, 836, 837, 838, 840, 841, 842, 843, 845, 846, 847, 848 : literal 4 is used;
- fsw_config.c: lines 8, 9, 10, 11, 12 : wrong positives : strings used to initialized variable;
- fsw_init.c: lines 359, 359, 359, 359, 360, 360, 360, 360, 361, 361, 361, 361, 362, 362, 362, 362, 363, 363, 363, 363, 364, 364, 364, 364, 365, 365, 365, 365, 366, 366, 366, 366, 367, 367, 367, 367, 368, 368, 368, 368, 369, 369, 369, 369, 370, 370, 370, 370, 371, 371, 371, 371, 372, 372, 372, 372, 373, 373, 373, 373, 374, 374, 374, 374, 375, 375, 375, 375, 376, 376, 376, 376, 377, 377, 377, 377, 378, 378, 378, 378, 381, 381, 381, 381, 382, 382, 382, 382, 384, 384, 384, 384, 385, 385, 385, 385, 386, 386, 386, 386, 387, 387, 387, 387, 388, 388, 388, 388, 390, 390, 390, 390, 865, 865, 865, 865, 877, 877, 877, 877, 889, 889, 889, 889, 901, 901, 901, 901, 913, 913, 913, 913 : wrong positives, use of function rtems_build_name to initialized tasks;
- fsw_misc.c: lines 201, 201, 201, 201, 618, 619, 620 : line 201 : wrong positives, use of function rtems_build_name, line 619 to 620 : use of literal 3,4 and 5 to update time.

#10 Updated by William Recart over 4 years ago

  • Status changed from In Progress to Resolved

RFW submitted : RPW-MEB-LFR-RFW-00256-LPP

#11 Updated by bruno katra almost 3 years ago

  • Status changed from Resolved to Closed

RFW signée et livrée en sept 2017 dans DP R3++ updated

#12 Updated by William Recart almost 3 years ago

Satus on FSW V3.2.0.21 : (RPW-MEB-LFR-RFW-00256-LPP accepted in DP R3++ updated)
- ccsds_types.h: lines 819, 820, 821, 822, 824, 825, 826, 827, 829, 830, 831, 832, 834, 835, 836, 837 : literal 4 is used;
- fsw_config.c: lines 8, 9, 10, 11, 12 : wrong positives : strings used to initialized variable;
- fsw_init.c: lines 363, 363, 363, 363, 364, 364, 364, 364, 365, 365, 365, 365, 366, 366, 366, 366, 367, 367, 367, 367, 368, 368, 368, 368, 369, 369, 369, 369, 370, 370, 370, 370, 371, 371, 371, 371, 372, 372, 372, 372, 373, 373, 373, 373, 374, 374, 374, 374, 375, 375, 375, 375, 376, 376, 376, 376, 377, 377, 377, 377, 378, 378, 378, 378, 379, 379, 379, 379, 380, 380, 380, 380, 381, 381, 381, 381, 382, 382, 382, 382, 383, 383, 383, 383, 384, 384, 384, 384, 387, 387, 387, 387, 388, 388, 388, 388, 390, 390, 390, 390, 391, 391, 391, 391, 392, 392, 392, 392, 393, 393, 393, 393, 394, 394, 394, 394, 396, 396, 396, 396, 901, 901, 901, 901, 913, 913, 913, 913, 925, 925, 925, 925, 937, 937, 937, 937, 949, 949, 949, 949 : wrong positives, use of function rtems_build_name to initialized tasks;
- fsw_misc.c: lines 228, 228, 228, 228, 580, 586, 586, 587, 729, 730, 731 : line 228: wrong positives, use of function rtems_build_name, line 580 to 731: use of literal 3,4 and 5 to update time.

Also available in: Atom PDF