From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 838AE4595A; Wed, 11 Sep 2024 05:47:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A5CF40E1D; Wed, 11 Sep 2024 05:47:53 +0200 (CEST) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id C22E6402DE for ; Wed, 11 Sep 2024 05:47:51 +0200 (CEST) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-7191df6b5f5so44898b3a.0 for ; Tue, 10 Sep 2024 20:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1726026471; x=1726631271; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=etoW3bOEcxal2frSsMY3tD5FZOf99CD1XPyxBEmauN8=; b=wjLY0J8mn5Xy5k1iQFVCKfrhQk9gveFH/ZnMec/+6vXaz/Cu8sssDWVNAx/C08s8lY 9QzhUllBzCd1RzHgh/p595zgpRhPzhjdykgtkq0aFlWRtf1kWTyTuTBa3JIDG99pCaGC zd2Td/XO2fk4u2dhSZyM9W3NhSChrtP00n5alV5R4cB1ELh53FKTCwxhceY2MeREzyxe Ef3vV97xeN8WDpz6tQQnDzR6EZagzdhvy57VLJpkgdqQALMKLODmCBLhqiGy/wG6KBFs dwwfBaGRwKhAWv3qBdOm3E6xS6vI+zT6x6HcmedMB62VWgQgceJXolvJpwxara+t2WYG lnSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726026471; x=1726631271; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=etoW3bOEcxal2frSsMY3tD5FZOf99CD1XPyxBEmauN8=; b=fvD0W7zofjWKZozqZuo6OCt7BlxvjUx3GlnBTHTxdMeFkGFDrNMl8I9bs/sem81REs FNuFXqX56/QMuXZLp46C6rG8gwP5kbjyS4wOa/Ka3Rh2KK8TEWgZt8kMZn4wK3JXOMqo bIecElRhm1L0CPjl49FjgN9CApYP76uR7Rdc1cB9XmQ8bqPOKEajf8Ydh4PH0TdS/F25 /tq2MU91covBsA25u9287LIahe5nEqBIcmy/eTfw3rhUnUnfKjIBv6YaVvNIzgObUydu dY5VEzw+H+6jN5yuriID/HsvovyZrQHu9/QaONTpKrJ0wLgYX4vA0NHealgZ5F7iNMUu 7/iA== X-Gm-Message-State: AOJu0YzJdHGxigv0y7dAxnB5517bnYVZTyBehT9M3v1nTzbDV/tTGkkg 1l7yzaeHRvgbZqPUpP34nsnsOGsdE8CxObRYk01MiXumVyf0RqA67Sy3RYW0G4k= X-Google-Smtp-Source: AGHT+IGTW0Yjejv65cBjUN//KnM50BQJ9ATYcV63EBLG0r0zEsJjzZed1pq1V0FvrEQneHY2wxJGGw== X-Received: by 2002:a05:6a00:cd1:b0:717:93d7:166b with SMTP id d2e1a72fcca58-718d5f1879fmr26076018b3a.25.1726026470740; Tue, 10 Sep 2024 20:47:50 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71908fc8ff7sm2148415b3a.15.2024.09.10.20.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 20:47:50 -0700 (PDT) Date: Tue, 10 Sep 2024 20:47:48 -0700 From: Stephen Hemminger To: "WanRenyong" Cc: , , Subject: Re: [PATCH v2 04/19] net/xsc: add xsc device init and uninit Message-ID: <20240910204748.1fee9fe1@hermes.local> In-Reply-To: <20240911020740.3950704-5-wanry@yunsilicon.com> References: <20240911020740.3950704-5-wanry@yunsilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, 11 Sep 2024 10:07:25 +0800 "WanRenyong" wrote: > + > + sprintf(path, "%s/device/uevent", dev_path); better to use snprintf for safety > + while (fgets(line, sizeof(line), file) == line) { > + size_t len = strlen(line); > + > + /* Truncate long lines. */ > + if (len == (sizeof(line) - 1)) { > + while (line[(len - 1)] != '\n') { > + int n = fgetc(file); > + > + if (n == EOF) > + goto out; > + line[(len - 1)] = n; > + } > + /* No match for long lines. */ > + continue; > + } If you have to deal with long lines better to use something like getline() that handles arbitrary length.