aslanalyze.c (6f3544cd7084abbadd83637993a4f41fd30e6ccd) aslanalyze.c (5a77b11bd396353d1820bff1ee51e58c2a6ee6a6)
1
2/******************************************************************************
3 *
4 * Module Name: aslanalyze.c - check for semantic errors
5 *
6 *****************************************************************************/
7
8/******************************************************************************

--- 670 unchanged lines hidden (view full) ---

679 ACPI_PARSE_OBJECT *Op,
680 ACPI_NAME Type)
681{
682 UINT32 i;
683 ACPI_SIZE Length;
684 UINT32 AlphaPrefixLength;
685
686
1
2/******************************************************************************
3 *
4 * Module Name: aslanalyze.c - check for semantic errors
5 *
6 *****************************************************************************/
7
8/******************************************************************************

--- 670 unchanged lines hidden (view full) ---

679 ACPI_PARSE_OBJECT *Op,
680 ACPI_NAME Type)
681{
682 UINT32 i;
683 ACPI_SIZE Length;
684 UINT32 AlphaPrefixLength;
685
686
687 /* Only care about string versions of _HID/_CID (integers are legal) */
688
687 if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)
688 {
689 return;
690 }
691
689 if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)
690 {
691 return;
692 }
693
694 /* For both _HID and _CID, the string must be non-null */
695
692 Length = strlen (Op->Asl.Value.String);
696 Length = strlen (Op->Asl.Value.String);
697 if (!Length)
698 {
699 AslError (ASL_ERROR, ASL_MSG_NULL_STRING,
700 Op, NULL);
701 return;
702 }
693
694 /*
703
704 /*
695 * If _HID/_CID is a string, all characters must be alphanumeric.
696 * One of the things we want to catch here is the use of
697 * a leading asterisk in the string -- an odd construct
698 * that certain platform manufacturers are fond of.
705 * One of the things we want to catch here is the use of a leading
706 * asterisk in the string -- an odd construct that certain platform
707 * manufacturers are fond of. Technically, a leading asterisk is OK
708 * for _CID, but a valid use of this has not been seen.
699 */
709 */
710 if (*Op->Asl.Value.String == '*')
711 {
712 AslError (ASL_ERROR, ASL_MSG_LEADING_ASTERISK,
713 Op, Op->Asl.Value.String);
714 return;
715 }
716
717 /* _CID strings are bus-specific, no more checks can be performed */
718
719 if (Type == ASL_TYPE_CID)
720 {
721 return;
722 }
723
724 /* For _HID, all characters must be alphanumeric */
725
700 for (i = 0; Op->Asl.Value.String[i]; i++)
701 {
702 if (!isalnum ((int) Op->Asl.Value.String[i]))
703 {
704 AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING,
705 Op, Op->Asl.Value.String);
706 break;
707 }
708 }
709
726 for (i = 0; Op->Asl.Value.String[i]; i++)
727 {
728 if (!isalnum ((int) Op->Asl.Value.String[i]))
729 {
730 AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING,
731 Op, Op->Asl.Value.String);
732 break;
733 }
734 }
735
710 if (Type == ASL_TYPE_CID)
711 {
712 /* _CID strings are bus-specific, no more checks can be performed */
713
714 return;
715 }
716
717 /* _HID String must be of the form "XXX####" or "ACPI####" */
718
719 if ((Length < 7) || (Length > 8))
720 {
721 AslError (ASL_ERROR, ASL_MSG_HID_LENGTH,
722 Op, Op->Asl.Value.String);
723 return;
724 }

--- 1392 unchanged lines hidden ---
736 /* _HID String must be of the form "XXX####" or "ACPI####" */
737
738 if ((Length < 7) || (Length > 8))
739 {
740 AslError (ASL_ERROR, ASL_MSG_HID_LENGTH,
741 Op, Op->Asl.Value.String);
742 return;
743 }

--- 1392 unchanged lines hidden ---