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 3C1BC45BB4; Wed, 23 Oct 2024 18:16:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12FC642E7F; Wed, 23 Oct 2024 18:16:17 +0200 (CEST) Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by mails.dpdk.org (Postfix) with ESMTP id 26C2142E6A for ; Wed, 23 Oct 2024 18:16:16 +0200 (CEST) Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7eb00dc77f1so1384844a12.1 for ; Wed, 23 Oct 2024 09:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1729700175; x=1730304975; 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=QoeST3kgil2XJBy6WZYqR/CFJVOwqsoD4Z2HXH/8YQ4=; b=H7agr2Qxx4OiGQYbHsNzRnxQfPM7JFkTgdDwbbqhM/w9+j6eR5b6XWcRivijJ+GUKH DK0d8Zyg+CMcKY2S4+wIT9MtPU+CyBjNSJd9JjDgmcA9n4sr8GlPZbCeLu0/TQTzgHro Fv74v7cc2ddMrdLNKvjXuQhret/Tda8Zk0LE9DkP3HAC0nkf4Q9e5dwxvH0kd07+3Nd4 3aJyzKCX8IvG1/pq9uMZLsaqrqEDAb9lv3Vigz6lsrihGJvYS6pZp5KtzjH0mxvhA+O9 3o9erEOfdnC6RCjNn6H8z1aPCw5UDlZle3a5Jdh5UPiXbeVoQRhoNqCecKhSrOaim5vk 8IdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729700175; x=1730304975; 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=QoeST3kgil2XJBy6WZYqR/CFJVOwqsoD4Z2HXH/8YQ4=; b=UDi7MMJwLLEhU2MukVMFgVsBwVy4mbXS9yodisp7rG+iwXJ9LuZJBjvXVD1DjaAm83 hmEUTL3ZHAmlcHJfVP/X9PgS/qfaqqMB5L37ohYrtcdvVf3aaN2O6iyZvhidgAmj5m/h rqvmmiUyNZukcig36PSkwLnDqzn+I7+P4npeXyeicVxQxVNJ+Q6kns5xtnuBvmDBQA9g p8Ga293MxMmJArvNHUjh1Olmk3/nOhImPqTkTntTa5wW8M3TX+TH2BvF3of7sbJ699/Z XTI2UkpBrqia2vZbpLQ0rn6zSGy/Ga8oJk3vcCAEbZE5q9LpAzGyBIqsxu57Z+i1O9tn PEVA== X-Forwarded-Encrypted: i=1; AJvYcCUAqsv+S6XIHqBmaQAvHfOYyJAG984Mgl75hkCu/7S+gXDKmIkwVJoCVJHVxwwTQG+0et4=@dpdk.org X-Gm-Message-State: AOJu0YyvX3xfcCZyo7L1z3wlifmsMK2ZN9NDssrlFr37gxO6KdD03ebd rXRtlVjw7Xsbi8RiRBqJk9uHkKQgJUV1l4bbdFJeQa4+p0UOyv9/kdT1IS0+e/Q= X-Google-Smtp-Source: AGHT+IH0muUFguMWOIKaUfL2oW+vTUSXHPbFygQLHdI1QiWtQv7SSiNBxTl+9Fm7epHN5jVhIu8qSg== X-Received: by 2002:a05:6a21:4781:b0:1d9:278a:9ab with SMTP id adf61e73a8af0-1d978bae95emr4181228637.35.1729700175079; Wed, 23 Oct 2024 09:16:15 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec132fefbsm6488530b3a.54.2024.10.23.09.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 09:16:14 -0700 (PDT) Date: Wed, 23 Oct 2024 09:16:13 -0700 From: Stephen Hemminger To: Hanumanth Pothula Cc: Jerin Jacob , , Subject: Re: [PATCH v2 1/1] event/octeontx: resolve possible integer overflow Message-ID: <20241023091613.545d03d7@hermes.local> In-Reply-To: <20241023071546.865609-1-hpothula@marvell.com> References: <20241018075903.53757-1-hpothula@marvell.com> <20241023071546.865609-1-hpothula@marvell.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, 23 Oct 2024 12:45:46 +0530 Hanumanth Pothula wrote: > static int > -ssovf_parsekv(const char *key __rte_unused, const char *value, void *opaque) > +ssovf_parsekv(const char *key, const char *value, void *opaque) > { > - int *flag = opaque; > - *flag = !!atoi(value); > + uint8_t *flag = opaque; > + uint64_t v; > + char *end; > + > + errno = 0; > + v = (uint8_t)strtoul(value, &end, 0); Cast will cause truncation of large values. Maybe: v = strtoul(value, &end, 0); if (errno != 0 || value == end || *end != '\0' || v > UINT8_MAX) { ... > + if ((errno != 0) || (value == end) || *end != '\0') { > + ssovf_log_err("invalid %s value %s", key, value); > + return -EINVAL; > + } > + > + *flag = !!v; > return 0; > }