public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: chandramohan.akula@broadcom.com
To: devel@edk2.groups.io
Subject: Uefi functions AddUnicodeString2() and LookupUnicodeString2() are returning EFI_UNSUPPORTED incorrectly
Date: Thu, 04 Feb 2021 22:30:11 -0800	[thread overview]
Message-ID: <jXP3.1612506611481485424.J2P4@groups.io> (raw)

[-- Attachment #1: Type: text/plain, Size: 1697 bytes --]

Hi,

The library functions AddUnicodeString2() and LookupUnicodeString2() defined in UefiLib.c are returning EFI_UNSUPPORTED incorrectly.
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-US;ja-JP;zh-Hans"  and the language as "en-US" to those two functions.
The above two functions are passing arguments incorrectly to the function IsLanguageSupported(). The function IsLanguageSupported() is expecting first argument "SupportedLanguages" and second argument "TargetLanguage".
But these functions are passing "TargetLanguage" as first and "SupportedLanguages" 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.tianocore.org/show_bug.cgi?id=3211
And attached the following patch:

diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c
index 835218f982..b6a33a0a48 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -839,7 +839,7 @@ LookupUnicodeString2 (
SupportedLanguages += 3;
}
} else {
-    Found = !IsLanguageSupported(Language, SupportedLanguages);
+    Found = !IsLanguageSupported(SupportedLanguages, Language);
}

@@ -1133,7 +1133,7 @@ AddUnicodeString2 (
SupportedLanguages += 3;
}
} else {
-    Found = !IsLanguageSupported(Language, SupportedLanguages);
+    Found = !IsLanguageSupported(SupportedLanguages, Language);
}
//
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED

[-- Attachment #2: Type: text/html, Size: 2254 bytes --]

                 reply	other threads:[~2021-02-05  6:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jXP3.1612506611481485424.J2P4@groups.io \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox