From nobody Sun Apr 28 08:00:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71302+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71302+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1612510205; cv=none; d=zohomail.com; s=zohoarc; b=UN22Sx0VHKAdxf5Aq1OFUOAuihtWv+4b/FMtMu2HQHzwpJsQBUOo8FYPOLxaWUnSi4o9jdrCgFeh5SHIBO+nrzdGmJ94iPDrqAOTbKtAUIzR8CwP1YDvY4HPmBk3d4aQe1gX82pAlDbshnyNxsPOuq2J77e9L3qvuLU/qOWgFvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612510205; h=Content-Type:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=6do2m2XbZkeGy0kHTkuHIXRCSDbF2dhu+NQ98iV/lys=; b=FjAHp/LV0HrVrBuyaqFcKYLhHDW5aWpYPZHwElYZBfakZDHq8IcS1YLP6icL7gakaVrvXeZfBoQS2dZIadDymb36dxSPC/slNBsi7lwPMt8SgZPisvAOAUhzkVKKD7LncRxG43Xf8GFNkNWy5Ls2AHkoTY0r/TbZmBZb3SGMgjY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71302+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1612510205406836.2920652745979; Thu, 4 Feb 2021 23:30:05 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id kcZkYY1788612xvHk4GO46Gy; Thu, 04 Feb 2021 23:30:04 -0800 Subject: [edk2-devel] Uefi functions AddUnicodeString2() and LookupUnicodeString2() are returning EFI_UNSUPPORTED incorrectly To: devel@edk2.groups.io From: "chandramohan.akula via groups.io" X-Originating-Location: Mumbai, Maharashtra, IN (34.93.130.17) X-Originating-Platform: Windows IE 18.19041 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Thu, 04 Feb 2021 22:30:11 -0800 Message-ID: Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chandramohan.akula@broadcom.com X-Gm-Message-State: S3V87Zk4aL9CFuBDOXMDxOTix1787277AA= Content-Type: multipart/alternative; boundary="z548fYgwCA2MNaIMHCIE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1612510204; bh=TK4cMDl+mTZQTnD7oQMc2ePhSLbxNOBpuw9v9yPWCuk=; h=Content-Type:Date:From:Reply-To:Subject:To; b=v7OpOKE91s20QKVPtyPWgBARl+G2EQefYQ+lVAAb6OAyIOkmh/fet8DnejyeACjezHX 5omy7Bxm5Xi5T/I7sF3rhUCtiQI9ZLjrVD6hq4bJLZ9GsEhBnXOF/jYMCx50QqPh6AnaK QzKTaE7JSEPixxdYF0Y9N91lDh9aQngNyug= X-ZohoMail-DKIM: pass (identity @groups.io) --z548fYgwCA2MNaIMHCIE Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Hi, The library functions AddUnicodeString2() and LookupUnicodeString2() define= d in UefiLib.c are returning EFI_UNSUPPORTED incorrectly. These functions are returning EFI_UNSUPPORTED because of not finding the gi= ven "Language" in "SupportedLanguages", even though it is part of it. Actually the function caller passing the supported language as ""en-US;ja-J= P;zh-Hans"=C2=A0 and the language as "en-US" to those two functions. The above two functions are passing arguments incorrectly to the function I= sLanguageSupported(). The function IsLanguageSupported() is expecting first= argument "SupportedLanguages" and second argument "TargetLanguage". But these functions are passing "TargetLanguage" as first and "SupportedLan= guages" as second one.=C2=A0 Due to this,=C2=A0 IsLanguageSupported() funct= ion returns that a given language is not supported I have filed a bug for this https://bugzilla.tianocore.org/show_bug.cgi?id= =3D3211 And attached the following patch: diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/Uefi= Lib.c index 835218f982..b6a33a0a48 100644 --- a/MdePkg/Library/UefiLib/UefiLib.c +++ b/MdePkg/Library/UefiLib/UefiLib.c @@ -839,7 +839,7 @@ LookupUnicodeString2 ( SupportedLanguages +=3D 3; } } else { -=C2=A0=C2=A0=C2=A0 Found =3D !IsLanguageSupported(Language, SupportedLangu= ages); +=C2=A0=C2=A0=C2=A0 Found =3D !IsLanguageSupported(SupportedLanguages, Lang= uage); } @@ -1133,7 +1133,7 @@ AddUnicodeString2 ( SupportedLanguages +=3D 3; } } else { -=C2=A0=C2=A0=C2=A0 Found =3D !IsLanguageSupported(Language, SupportedLangu= ages); +=C2=A0=C2=A0=C2=A0 Found =3D !IsLanguageSupported(SupportedLanguages, Lang= uage); } // // If Language is not a member of SupportedLanguages, then return EFI_UNSUP= PORTED -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71302): https://edk2.groups.io/g/devel/message/71302 Mute This Topic: https://groups.io/mt/80401075/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --z548fYgwCA2MNaIMHCIE Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Hi,

The library functions AddUnicodeString2() and LookupUni= codeString2() defined in UefiLib.c are returning EFI_UNSUPPORTED incorrectl= y.
These functions are returning EFI_UNSUPPORTED because of not finding = the given "Language" in "SupportedLanguages", even though it is part of it.=
Actually the function caller passing the supported language as ""en-U= S;ja-JP;zh-Hans"  and the language as "en-US" to those two functions.<= /div>
The above two functions are passing arguments incorrectly to the func= tion IsLanguageSupported(). The function IsLanguageSupported() is expecting= first argument "SupportedLanguages" and second argument "TargetLanguage".<= /div>
But these functions are passing "TargetLanguage" as first and "Suppor= tedLanguages" as second one.  Due to this,  IsLanguageSupported()= function returns that a given language is not supported

I have = filed a bug for this https://bugzilla.tianoc= ore.org/show_bug.cgi?id=3D3211
And attached the following patch:
diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/Ue= fiLib/UefiLib.c
index 835218f982..b6a33a0a48 100644
--- a/MdePkg/= Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
= @@ -839,7 +839,7 @@ LookupUnicodeString2 (
    &nb= sp;  SupportedLanguages +=3D 3;
     }
&= nbsp;  } else {
-    Found =3D !IsLanguageSupporte= d(Language, SupportedLanguages);
+    Found =3D !IsLang= uageSupported(SupportedLanguages, Language);
   }
 = ;
 
@@ -1133,7 +1133,7 @@ AddUnicodeString2 (
 &nb= sp;     SupportedLanguages +=3D 3;
  &nb= sp;  }
   } else {
-    Found =3D != IsLanguageSupported(Language, SupportedLanguages);
+   = Found =3D !IsLanguageSupported(SupportedLanguages, Language);
 &= nbsp; }
   //
   // If Language is not a memb= er of SupportedLanguages, then return EFI_UNSUPPORTED

_._,_._,_

Gr= oups.io Links:

You receive all messages sent to this group.

Vie= w/Reply Online (#71302) | | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [importer@patchew.org]

_._,_._,_
=20 --z548fYgwCA2MNaIMHCIE--