From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33B0CA04B1; Thu, 5 Nov 2020 09:59:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F3E2669C8; Thu, 5 Nov 2020 09:59:37 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 66D4D69A4 for ; Thu, 5 Nov 2020 09:59:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604566773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XAQORfJ7mEK8TnZ+SBEFjKjZeN+fHPVgkrBtEXggj78=; b=bnd44JKPAnp/UwEewStjvgwnhyVqn97e/qFMVxL3fbe2rjKn7KCjM6P1CYHhClEqJfBX4q c8vd18KNnuzfFlgI2/nxnPDxlC0X6nzpMHtXU562n+Xsnnx9DC743Qy990usH4djgyLQgU nitsVwTPMuIdRHJaj/Dn7Iwu322g8aA= Received: from mail-vs1-f69.google.com (mail-vs1-f69.google.com [209.85.217.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-267-hCuGpjJVOJSO0upLISdDSQ-1; Thu, 05 Nov 2020 03:59:30 -0500 X-MC-Unique: hCuGpjJVOJSO0upLISdDSQ-1 Received: by mail-vs1-f69.google.com with SMTP id n126so464759vsn.22 for ; Thu, 05 Nov 2020 00:59:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XAQORfJ7mEK8TnZ+SBEFjKjZeN+fHPVgkrBtEXggj78=; b=QL1PLwW2nVHRoNcGWBNckzAMbPYaWsZMdG2fKag9ABTnbf9WroA+Vybj1VPK+b0pF4 yFHA4W0F04a9Vo6How8KI1e71DKfrwVwDDl2KSUETaoVEBM0+F11ACVg8RyyrrUMfZo5 NStVI9NDlnfpgw+iOfZRTy2hnPuCqN8NBOKmv80VQ4ZS+OIXxikCXe51HcybzJmNt1HI k6vz9eGO/fg0+U4aAoabiCXiCJbRV0eXhGJ/DlzlIB2exNvkfX5RtADc6oy/Xh3XvqPa LEYs9/c4a9nFeQNQ8EK+yVKC0dxSVelsoyN4J65Dbe5FjuRayYBgpeLXb8zIw6mnHNza 927w== X-Gm-Message-State: AOAM530M+iORacziBVt2GmwTMwQ4Aj+9/fNgcNhY7gwmgdP9W+meCftd YDGz2/z4OOaGB+HthKLV83wSTRAciIEjlYSj0DMG1Pepxg9cBJC1376y4hH97a3SF8h51nzRWPx 18Yx3JNw98nDTfeJ+AoI= X-Received: by 2002:a67:f954:: with SMTP id u20mr568505vsq.5.1604566769612; Thu, 05 Nov 2020 00:59:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxk2bhJ1QRa8/iGfLg/LwTgrT6SFIXEACgqcZ2T8rYdx6DEPmoSJs+6nfPtesBaGuIFUYa6Lr5JTE349ws10ow= X-Received: by 2002:a67:f954:: with SMTP id u20mr568496vsq.5.1604566769426; Thu, 05 Nov 2020 00:59:29 -0800 (PST) MIME-Version: 1.0 References: <20201029125339.30916-1-ibtisam.tariq@emumba.com> In-Reply-To: From: David Marchand Date: Thu, 5 Nov 2020 09:59:18 +0100 Message-ID: To: Ibtisam Tariq Cc: "Kovacevic, Marko" , "Ananyev, Konstantin" , "Pattan, Reshma" , "Mcnamara, John" , Cristian Dumitrescu , "Singh, Jasvinder" , "Xia, Chenbo" , Maxime Coquelin , Xiaoyun Li , dev Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/8] examples/fips_validation: enhance getopt_long usage X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hello Ibtisam, On Wed, Nov 4, 2020 at 11:00 AM Ibtisam Tariq wrote: > > + case MBUF_DATAROOM_KEYWORD_NUM: > > + { > > + uint32_t data_room_size; > > Here, I don't think we need a temp storage. > If the value is invalid, the parsing and then init will fail. > You can directly pass &env.mbuf_data_room to parser_read_uint32 and > check its value. > > > > > > > - env.mbuf_data_room = data_room_size; > > - } else { > > + if (parser_read_uint32(&data_room_size, > > + optarg) < 0) { > > cryptodev_fips_validate_usage(prgname); > > return -EINVAL; > > } > > + > > + if (data_room_size == 0 || > > + data_room_size > UINT16_MAX) { > > + cryptodev_fips_validate_usage(prgname); > > + return -EINVAL; > > + } > > + > > + env.mbuf_data_room = data_room_size; > > + > > break; > > + } > > The type of env.mbuf_data_room is uint16_t and the temp variable type > is uint32_t. In my opinion, the temp variable size is bigger than > env.mbuf_data_room to handle overflow value. All of it could be moved to a read_uint16 parser. WDYT? -- David Marchand