From: Andreas Reichel <[email protected]>

If a variable like watchdog is set with a negative argument,
bg_setenv returns this negative argument instead of -EINVAL.
Fix this to -EINVAL.

Signed-off-by: Andreas Reichel <[email protected]>
---
 env/env_api_fat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/env/env_api_fat.c b/env/env_api_fat.c
index c51eec5..2f71094 100644
--- a/env/env_api_fat.c
+++ b/env/env_api_fat.c
@@ -371,7 +371,7 @@ int bgenv_set(BGENV *env, char *key, uint64_t type, void 
*data,
        case EBGENV_REVISION:
                val = bgenv_convert_to_long(value);
                if (val < 0) {
-                       return val;
+                       return -EINVAL;
                }
                env->data->revision = val;
                break;
@@ -384,21 +384,21 @@ int bgenv_set(BGENV *env, char *key, uint64_t type, void 
*data,
        case EBGENV_WATCHDOG_TIMEOUT_SEC:
                val = bgenv_convert_to_long(value);
                if (val < 0) {
-                       return val;
+                       return -EINVAL;
                }
                env->data->watchdog_timeout_sec = val;
                break;
        case EBGENV_USTATE:
                val = bgenv_convert_to_long(value);
                if (val < 0) {
-                       return val;
+                       return -EINVAL;
                }
                env->data->ustate = val;
                break;
        case EBGENV_IN_PROGRESS:
                val = bgenv_convert_to_long(value);
                if (val < 0) {
-                       return val;
+                       return -EINVAL;
                }
                switch(val) {
                case 1:
-- 
2.17.0

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/20180525120108.31055-12-andreas.reichel.ext%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to