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 DB27245966; Thu, 12 Sep 2024 05:58:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77AD340663; Thu, 12 Sep 2024 05:58:12 +0200 (CEST) Received: from lf-2-47.ptr.blmpb.com (lf-2-47.ptr.blmpb.com [101.36.218.47]) by mails.dpdk.org (Postfix) with ESMTP id D67D54027D for ; Thu, 12 Sep 2024 05:58:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1726113483; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=REJ1PCkzUtGTQBUa/s7/GXwXi08YRsUx6zB9gmfqyvU=; b=h3dyOkI9ZXcpawcuhz9b30L5U5RewKKw8LXOOUms0QOzc4y6Jm222uPpqwgao7TvQJdQiV p63NyoIkNtYkSjPc81GXtp72c77CEzbqdzcIhX7oaIsjxmE17KbvacxFqbQeSjGRwTh6yo DwUPALB85/aC+muia22pS0/XgADY92qlj1dXc/hZDFgp9R/0vzTzG/qYwJBJTEDgoYDbNm coGWBXrGY9U8murinsUWErpjY24wSvSL3qy3ADsNLFGUiwVK9PGfILu6pHRo8vzfnPq9mO wd6725BM67ksDISxOL82M3MeYAKk764BIxiaMW9vOfnv6gajzKzsPkWG9YXDYQ== Date: Thu, 12 Sep 2024 11:58:00 +0800 X-Original-From: WanRenyong Mime-Version: 1.0 References: <20240911020740.3950704-5-wanry@yunsilicon.com> <20240910204748.1fee9fe1@hermes.local> Received: from [127.0.0.1] ([180.158.103.102]) by smtp.feishu.cn with ESMTPS; Thu, 12 Sep 2024 11:58:01 +0800 Subject: Re: [PATCH v2 04/19] net/xsc: add xsc device init and uninit Message-Id: Cc: , , Content-Type: text/plain; charset=UTF-8 User-Agent: Mozilla Thunderbird Content-Transfer-Encoding: quoted-printable X-Lms-Return-Path: In-Reply-To: <20240910204748.1fee9fe1@hermes.local> To: "Stephen Hemminger" From: "WanRenyong" 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 2024/9/11 11:47, Stephen Hemminger wrote: > On Wed, 11 Sep 2024 10:07:25 +0800 > "WanRenyong" wrote: > >> + >> + sprintf(path, "%s/device/uevent", dev_path); > better to use snprintf for safety OK,=C2=A0 will fix it in next version. >> + while (fgets(line, sizeof(line), file) =3D=3D line) { >> + size_t len =3D strlen(line); >> + >> + /* Truncate long lines. */ >> + if (len =3D=3D (sizeof(line) - 1)) { >> + while (line[(len - 1)] !=3D '\n') { >> + int n =3D fgetc(file); >> + >> + if (n =3D=3D EOF) >> + goto out; >> + line[(len - 1)] =3D 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. I will think about it. Hello Stephen, Thanks for your review,=C2=A0 my reply please see above. --=20 Thanks, WanRenyong