public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Question/bug in ArmPkg (ArmArchTimerLib)
@ 2023-01-26 12:06 Gierszynski, Przemyslaw
  2023-01-27 13:52 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Gierszynski, Przemyslaw @ 2023-01-26 12:06 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Leif Lindholm, Ard Biesheuvel, Sami Mujawar


[-- Attachment #1.1: Type: text/plain, Size: 2097 bytes --]

Hi All,

My name is Przemysław Gierszyński and I work as a Firmware Engineer in Intel Technology Poland.
I was doing some work that required review of some parts of EDK2 and I think I have found a small bug in ArmPkg module.
Here below are some details concerning the issue:
File: edk2/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
Function: TimerContructor ( VOID ) - line 56
Description:
The comment above says: "If the security extension is not implemented, set Timer Frequency here.".
In releases from the past in the if condition there was direct accessing to ID_PFR1, and it was changed in the commit shown below.
[cid:image001.png@01D93185.A4DC9070]
But if we go into the body of the ArmHasSecurityExtensions () function, we can see that the result of the function is a negation of the condition from the past:
[cid:image002.png@01D93186.59443040]

Proposal of solution:
Change the if condition in TimerContructor () function from: if (ArmHasSecurityExtensions ()) to if (!ArmHasSecurityExtensions ())

Thank you for your help!

Best regards
Przemek

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.

[-- Attachment #1.2: Type: text/html, Size: 4904 bytes --]

[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 32183 bytes --]

[-- Attachment #3: image002.png --]
[-- Type: image/png, Size: 18872 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question/bug in ArmPkg (ArmArchTimerLib)
  2023-01-26 12:06 Question/bug in ArmPkg (ArmArchTimerLib) Gierszynski, Przemyslaw
@ 2023-01-27 13:52 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2023-01-27 13:52 UTC (permalink / raw)
  To: Gierszynski, Przemyslaw
  Cc: devel@edk2.groups.io, Leif Lindholm, Ard Biesheuvel, Sami Mujawar

On Thu, 26 Jan 2023 at 13:06, Gierszynski, Przemyslaw
<przemyslaw.gierszynski@intel.com> wrote:
>
> Hi All,
>
> My name is Przemysław Gierszyński and I work as a Firmware Engineer in Intel Technology Poland.
> I was doing some work that required review of some parts of EDK2 and I think I have found a small bug in ArmPkg module.
> Here below are some details concerning the issue:
> File: edk2/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
> Function: TimerContructor ( VOID ) – line 56
> Description:
> The comment above says: “If the security extension is not implemented, set Timer Frequency here.”.
> In releases from the past in the if condition there was direct accessing to ID_PFR1, and it was changed in the commit shown below.
>
> But if we go into the body of the ArmHasSecurityExtensions () function, we can see that the result of the function is a negation of the condition from the past:
>
>
> Proposal of solution:
> Change the if condition in TimerContructor () function from: if (ArmHasSecurityExtensions ()) to if (!ArmHasSecurityExtensions ())
>

Good catch!

Please submit a patch to the mailing list.

Thanks,
Ard.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-27 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-26 12:06 Question/bug in ArmPkg (ArmArchTimerLib) Gierszynski, Przemyslaw
2023-01-27 13:52 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox