From patchwork Wed Dec 18 10:29:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados X-Patchwork-Id: 13913369 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E9F11DFE0C for ; Wed, 18 Dec 2024 10:30:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734517812; cv=none; b=fJiJ5el9fpNscA5CjkeFj41A63vuG2xtyGaurHO34DlBiBv2WU4R+KHPY0lSYEpESzxKCBA10CB3+D/zTqBQkyoqX6Y1jpQbY9lHfRCw5dJ6tcM0TR0EPwy2Jn5Pk42/9TjjraAT6TZ2fehSMYsELWLwW7wUHKwv2T5lOZLiiRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734517812; c=relaxed/simple; bh=bGbxHk/oOI1UiN1TNn3H56GZV7Xir+xzbDLx5Xo3kUg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Yywic2yj0AJExnTldt2oR0KLRW6vzHInI/ygwIaOGdVJJVgP1KGvmuvsnJre9Rl7SnE/Zpl5uBe5+SO/HpBTD8lv6bX4fFRtoR7mYmr6PD/B3Mh8GyABtpkbGlV7cswcNhpZN2mcH6A6xjxJijBDUBAisyVicqsLYkA2ASxaPHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cJ1py/yL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cJ1py/yL" Received: by smtp.kernel.org (Postfix) with ESMTPS id 2C66FC4CED4; Wed, 18 Dec 2024 10:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734517812; bh=bGbxHk/oOI1UiN1TNn3H56GZV7Xir+xzbDLx5Xo3kUg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cJ1py/yLEhR5Baa6p5PEn5mGlGfPXKEbJoH6E9MndQJ0yiBlIjfaVqbGfNZEVkEf6 0lSHM6Yfg8e2AFFFWXHkLdtHOVtyqOZgATj3K006uv/7vcgZdCbm4Gl4QqSOf8x1Tr eiAN0TqU0I40+0nwVdx6CWvhNdhArtbIkqP/VwToDCnR9eTTrvTVnjfRjOsJZgf16+ Vq3g1uYuYZ/SOzC3q6s4oueh/KTsIBqLD2hckWroCMGna7uYEgQ/i+I4g6XfXpsVJ2 5jblcsSpyVlccWxFnZ2C4fqcX8/gv+ZDuBGPA2Rk4FZIik2QFLBr/Rf24y0qGKFtj3 1oIfFqAVy/8Fw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 153D4E77188; Wed, 18 Dec 2024 10:30:12 +0000 (UTC) From: Joel Granados Date: Wed, 18 Dec 2024 11:29:55 +0100 Subject: [PATCH 01/12] Kconfig: Add error path in conf_value_to_yaml Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241218-jag-bringup_fixes-v1-1-0bf2e07c640c@kernel.org> References: <20241218-jag-bringup_fixes-v1-0-0bf2e07c640c@kernel.org> In-Reply-To: <20241218-jag-bringup_fixes-v1-0-0bf2e07c640c@kernel.org> To: kdevops@lists.linux.dev Cc: Joel Granados , da.gomez@samsung.com X-Mailer: b4 0.15-dev-00a43 X-Developer-Signature: v=1; a=openpgp-sha256; l=1224; i=joel.granados@kernel.org; h=from:subject:message-id; bh=bGbxHk/oOI1UiN1TNn3H56GZV7Xir+xzbDLx5Xo3kUg=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGdipCvz1wWmZEZZi5o483Dz4xKiud6OXcXxQ KCwDJyO+BRUiIkBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJnYqQrAAoJELqXzVK3 lkFPnYEL/01tgYp2GYYNMRI5uF5MJH6jcZWuHSDVpJFaH/wDq8ATxBNf3N7w8qa+zlhUK/vDbQT DHOnSSXYwHMySR1491FITI0up8nDub+XunxYdQmEXWdkQ5TQfezIsFpQP7+N52xlt/kIZab7gKi jd89QKMLoEpA+C40E3CzIjimuEI2SLhZRI0FBjNtHGoy1Yg6kv6hlDhfhCQDZUCm7L0t2WOidNz 6yP2SIDss3X98e9XFVxv77VlWOWaLVtR6CaSbn56N9lJaczgoCyStTsNo36b2vlRc7oX1HUxC90 MSefx5ByGl8B5kSZjaSUfeP1KT9tkUTuF/KUueIJSS/i5QMgpWscT4I+Ik2fOEQ4Awtmpa+FauZ 51VqdVHtYUPERjX7M2o0ed/zxLmd8TneMq8Ay7UVRDeeCHHM27m7TgTkun/csVqyuNhe2PHH4BF 7yh+I/qOxtLHCX944qo62TSL/NqkJ7peOYLep7AcTrmQw43G7Wi+5KThuji1ZtXeUgPpvsq9K66 Jw= X-Developer-Key: i=joel.granados@kernel.org; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for joel.granados@kernel.org/default with auth_id=239 The asprintf call returns -1 on error. In this case the value of yaml_value is undefined. Return NULL, so the caller can handle the error. Signed-off-by: Joel Granados --- scripts/kconfig/confdata.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 0156b38..49a5729 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -669,14 +669,14 @@ static char *conf_value_to_yaml(struct symbol *sym, const char *val) yaml_value = strdup(val); break; case S_HEX: - asprintf(&yaml_value, "0x%s", val); - break; - case S_STRING: - /* Wrap strings in quotes */ - asprintf(&yaml_value, "\"%s\"", val); - break; - case S_BOOLEAN: - case S_TRISTATE: + if (asprintf(&yaml_value, "0x%s", val) < 0) + return NULL; + case S_STRING: + /* Wrap strings in quotes */ + if (asprintf(&yaml_value, "\"%s\"", val) < 0) + return NULL; + case S_BOOLEAN: + case S_TRISTATE: if (strcmp(val, "y") == 0) yaml_value = strdup("True"); else if (strcmp(val, "n") == 0)