From patchwork Thu Aug 19 11:19:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1518604 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=ILCmw2Bu; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gr2PW1bxzz9t18 for ; Thu, 19 Aug 2021 21:20:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5A33682E67; Thu, 19 Aug 2021 13:20:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="ILCmw2Bu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7ACD382EBB; Thu, 19 Aug 2021 13:20:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6ACA682EBB for ; Thu, 19 Aug 2021 13:19:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-wm1-x329.google.com with SMTP id o15so3607261wmr.3 for ; Thu, 19 Aug 2021 04:19:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=seLJNMkzyj86i9TxsANeEi32TL/1HtkIND1GG/1to2I=; b=ILCmw2Bud18IwOjZLGxazFO2zJe0zwCR5W1PCD4zGDRgsOkyOt32FyceRbDBSV3UJ7 0K0o7wglqiQ09Hesv5AysnSdZjGpeH/1PQLxAlgQ2eCpCDhOXlMF2kJH5lY/oqAQc1gN Jcc4Ift5hzeV/txZLgunnHAsYLTTngJAMaPDR6d6gyueBlS8ZNpSSIN4azVPe4yX5Qhg bzADqKD70DhlkMXSX+erNyp4XoFuAUvMwiXqBuHhNxD2fxtHyDUbTgF0I/JFJDGOq3q3 GuE7ZbDfqnC3pIKdGD3rPweq3JhFRzDfOQ3JnR2t7/EVgXo01j4mVFgYBgTf1PHU/WcQ MI6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=seLJNMkzyj86i9TxsANeEi32TL/1HtkIND1GG/1to2I=; b=GE/H0z7zSwCR+9Z09U8n05HJUBsHzSVlruDmv4u6IMrNvTDYRPJ5WWhETfusJmwVT1 d4ROZ3/4xLxyWNN9bXm6N42lF3YxwFzCEnFs0mbhawmq5BzlAKUFp3tIp0rSKVlT1d4/ EmScIq6Y9DYBKRkOe4sdG4yQ5pL/C4suDOX6giwIF+3Q/882/OeOAmylG0SlOJF4M5Qi 7uAeKDAH7qaU0jm2aXLrKVGXhnqVi2MzlQa4h/Y9pBZqLmKR3VMtgbifqg1UeIllXlFJ aBihg8LqZAN4y6JqHFbO5rNvWC8NdBTXrGD4GjIWRBwZb0L2TnLzvGUV5d+QtJU6mHiv M76A== X-Gm-Message-State: AOAM533T/NaXK3+ltkmyPEp1tqhFCQNLrPzI+asrjW+POxLLOnzu4sjE 4wz+xehrGhrQBh+jGoKaH+UICJ/afFx29qG+ X-Google-Smtp-Source: ABdhPJyeHTCVB5EyDkZR829Fva1QdrydW028KCTfXG3/X7QlwuR1ZGx9f25h+0xV2btG2kFYitEcfg== X-Received: by 2002:a05:600c:290:: with SMTP id 16mr13464791wmk.187.1629371995833; Thu, 19 Aug 2021 04:19:55 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6:f666:9af6:3fed:e53b]) by smtp.gmail.com with ESMTPSA id d4sm2782515wrc.34.2021.08.19.04.19.55 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Aug 2021 04:19:55 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Ashok Reddy Soma , Michal Simek , T Karthik Reddy Subject: [PATCH 01/10] xilinx: fru: Replace spaces with \0 in detected name Date: Thu, 19 Aug 2021 13:19:40 +0200 Message-Id: <6c4fac6edfc77f94f483d4697ed158437970fb63.1629371983.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean FRU spec expected \0 for unused symbols but unfortunately a lot of boards are using spaces instead of \0. That's why after saving it to desc->name name is checked again and all spaces are converted to \0. This will ensure that names can be used for string manipulations like concatenation. Signed-off-by: Michal Simek --- board/xilinx/common/board.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 90c87bab5cff..1458b31c21a9 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -168,7 +168,7 @@ static bool xilinx_detect_legacy(u8 *buffer) static int xilinx_read_eeprom_fru(struct udevice *dev, char *name, struct xilinx_board_description *desc) { - int ret, eeprom_size; + int i, ret, eeprom_size; u8 *fru_content; /* FIXME this is shortcut - if eeprom type is wrong it will fail */ @@ -207,6 +207,10 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, char *name, sizeof(desc->manufacturer)); strncpy(desc->name, (char *)fru_data.brd.product_name, sizeof(desc->name)); + for (i = 0; i < sizeof(desc->name); i++) { + if (desc->name[i] == ' ') + desc->name[i] = '\0'; + } strncpy(desc->revision, (char *)fru_data.brd.rev, sizeof(desc->revision)); strncpy(desc->serial, (char *)fru_data.brd.serial_number,