From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-f169.google.com (mail-yw0-f169.google.com [209.85.161.169]) by dpdk.org (Postfix) with ESMTP id AA5277E93 for ; Wed, 18 May 2016 15:45:15 +0200 (CEST) Received: by mail-yw0-f169.google.com with SMTP id g133so48078667ywb.2 for ; Wed, 18 May 2016 06:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=VaH6jmXmqP9N1WiTwFUqphE+Ioedp+dlG5CQ7cAL25A=; b=CRUR4XlvS0oGPHd6FNcxqbc2kVfRI1edFletTsB8oT8rFpPx2ZAznK4yhEfykFMG9A 2b+T/kRl9Kpvb2TKwEiviA/hCAEdkcMnP09uiSXPFIQ0hOIgv9BY+6bNiXQZ7n2G817Q ooOfAuRk0iR8gHo7NH0W1+12sQBqz+SndbGgg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=VaH6jmXmqP9N1WiTwFUqphE+Ioedp+dlG5CQ7cAL25A=; b=VTYJEoeiY6clETSZY9k6imE+IhXchp74cDPNWpNMtJwsP9S7mZJroGj0Wvzdl5f/xJ rS2p+jju5Atjc/2wEViocoFWJvbCmT/FoYEY01czU5XIcC3OZ4JJRZaU2HZ25ZDhGUoJ JSwateybxJkPVdWdju0zyVpKkhmfnodLlVmUxZtQGzyVZ3iDDW28m7zya60rdO79ayaC bxAzsFhjC+NdpyXy0IvOgYN/x/vo8ws1/ezoygN4eoqrQzazBCEq5d+cpzvffT359S89 0dzSZv/tEAS7RJPYjE9I6w9V9o6t+T5esL6OWQsyLLJdZfI2PQ8/PkGaCzkxx+AaxaQ1 OH6A== X-Gm-Message-State: AOPr4FWOTAhT+Fh05jXazv5h7oOuR7Q48otqsm1ehxK6B9x0/dImOJWUSZoX6vhIjO2woPT/eE8/bv4qov7k4F5V MIME-Version: 1.0 X-Received: by 10.13.203.15 with SMTP id n15mr3989882ywd.321.1463579115130; Wed, 18 May 2016 06:45:15 -0700 (PDT) Received: by 10.37.223.133 with HTTP; Wed, 18 May 2016 06:45:15 -0700 (PDT) In-Reply-To: <20160517201424.4430b7f0@pcviktorin.fit.vutbr.cz> References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com> <1462542490-15556-1-git-send-email-viktorin@rehivetech.com> <1462542490-15556-4-git-send-email-viktorin@rehivetech.com> <20160517201424.4430b7f0@pcviktorin.fit.vutbr.cz> Date: Wed, 18 May 2016 21:45:15 +0800 Message-ID: From: Jianbo Liu To: Jan Viktorin Cc: dev@dpdk.org, David Marchand , Thomas Monjalon , Bruce Richardson , Declan Doherty , Jerin Jacob , Keith Wiles , Stephen Hemminger Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH v1 03/28] eal/linux: extract function rte_eal_unbind_kernel_driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2016 13:45:15 -0000 On 18 May 2016 at 02:14, Jan Viktorin wrote: > On Fri, 13 May 2016 09:22:23 +0800 > Jianbo Liu wrote: > >> On 6 May 2016 at 21:47, Jan Viktorin wrote: >> > Generalize the PCI-specific pci_unbind_kernel_driver. It is now divided into >> > two parts. First, determination of the path and string identification of the >> > device to be unbound. Second, the actual unbind operation which is generic. >> > - if ((n < 0) || (n >= (int)sizeof(buf))) { >> > + if ((n < 0) || (n >= (int)sizeof(devid))) { >> >> Is it better to move "(n >= (int)sizeof(devid))" before snprintf and >> it has different reason from "n < 0"? > > I don't understant this comment. I cannot move the check for _n_ before > the snprintf as it is its return value... Can you provide an example of > your idea? > > Do you mean to split the condition to if (n < 0) and else if (n >= ...)? > No, I thought the correct output of devid is a fixed-size string, and need to check the buf length before snprintf. but it seems unnessaray. Sorry :(