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 330D9A0A0E for ; Fri, 14 May 2021 10:13:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25CC1410DA; Fri, 14 May 2021 10:13:59 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 9A57140041 for ; Fri, 14 May 2021 10:13:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620980036; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QzmyXHu58JkzcddkWps9ukdjBofO9yGIsfQP6AfMjuk=; b=K+CdRpi4MXNOas28n5kcDQpd+BsSjNnUgs+wqMc/mDIcg5fKLOlgUqze5PWcfJapyZuhyI /c5fJdncqUQhXzAD7p7KUaa9eny+u4UrS4U5EORJD6wGBlBzNInJN5qdLIsnELHFy0LldA q/G0lJAQnY9+btRCMWDfydKlke9vLok= Received: from mail-ua1-f71.google.com (mail-ua1-f71.google.com [209.85.222.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-5-x8sB1oPvqfKEQgfUPNYQ-1; Fri, 14 May 2021 04:13:53 -0400 X-MC-Unique: 5-x8sB1oPvqfKEQgfUPNYQ-1 Received: by mail-ua1-f71.google.com with SMTP id t19-20020ab021530000b029020bc458f62fso3328951ual.20 for ; Fri, 14 May 2021 01:13:53 -0700 (PDT) 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:content-transfer-encoding; bh=QzmyXHu58JkzcddkWps9ukdjBofO9yGIsfQP6AfMjuk=; b=eWaeRlCgTVkTZPQYeQBcAWshWKKvbRtS3mnmDMYUVveI5/18wCmhCzCrU86royF8sQ A/5u6OK3CWX3/nFwRl7k8J267NDdxIYbLUGHBleF/qnwsFSEGh5nV+UfZ2N5V48MnVDW u8wRyQYx9HtBEBpixZ4JkvGksYANK/7P5wQnHOHVfe/Q34cH5SnDogT8gJtLpfllnEAB i4UleE5jYah420A9eo7kPpZB8KkKVXLHbqwUnsYzcRMKq7NdAG/8c0wPY15Kmg/upNdM f53dYKnBdPtbJ9IbYzW0A8ow1XqrLlrs1HOCL0S7o1Dc2Z5SORTK+LwsJ+S5nhuq4eik S0Iw== X-Gm-Message-State: AOAM5330pOV9R22z/xfwbZNQIypQpDTZshzZrJQ/tKBqVkSVYnaeiNqU RD5mr1pQtbbn8NYK5fEdcMCuXEYK4upltgOFlBodIpNZzhZ69v045rgX9OPwlq9LAQhcY50Js95 QKJrzQylRbkEPYuQfS73r+P8= X-Received: by 2002:ab0:6497:: with SMTP id p23mr41092173uam.86.1620980032750; Fri, 14 May 2021 01:13:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcdL3YplIjA/Zy44YK5++rRuRU5DCqPWTkfBE5LJt+5cFy7dqCPKdrwJElAPf/Pp2PKjiMRlZPNjIE4gM+qUs= X-Received: by 2002:ab0:6497:: with SMTP id p23mr41092137uam.86.1620980032578; Fri, 14 May 2021 01:13:52 -0700 (PDT) MIME-Version: 1.0 References: <20210514074113.2666225-1-feifei.wang2@arm.com> In-Reply-To: From: David Marchand Date: Fri, 14 May 2021 10:13:41 +0200 Message-ID: To: Feifei Wang Cc: John Griffin , Fiona Trahe , Deepak Kumar Jain , Herbert Guan , Jerin Jacob , dev , nd , dpdk stable , Ruifeng Wang 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" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-stable] [PATCH] crypto/qat: fix uninitilized compiler warning X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Fri, May 14, 2021 at 10:01 AM Feifei Wang wrote: > > > @@ -1190,8 +1190,8 @@ static int partial_hash_compute(enum > > icp_qat_hw_auth_algo hash_alg, > > > uint8_t *data_out) { > > > int digest_size; > > > - uint8_t digest[qat_hash_get_digest_size( > > > - ICP_QAT_HW_AUTH_ALGO_DELIMITER)]; > > > + uint8_t *digest =3D (uint8_t *)calloc(qat_hash_get_digest_siz= e( > > > + ICP_QAT_HW_AUTH_ALGO_DELIMITER), > > > + sizeof(uint8_t)); > > > > calloc can fail. > > cast is unneded. > > > > A simple uint8_t digest[...] =3D { 0 } would do the job. > > Thanks for your comment. Actually, we have tried to use this simple metho= d: > uint8_t digest[qat_hash_get_digest_size(ICP_QAT_HW_AUTH_ALGO_DELIMITER)]= =3D {0}; > > And it will report compile error: > ../drivers/crypto/qat/qat_sym_session.c:1194:4: error: variable-sized obj= ect may not be initialized > 1194 | ICP_QAT_HW_AUTH_ALGO_DELIMITER)] =3D {0}; > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ../drivers/crypto/qat/qat_sym_session.c:1194:40: warning: excess elements= in array initializer > 1194 | ICP_QAT_HW_AUTH_ALGO_DELIMITER)] =3D {0}; > | ^ > ../drivers/crypto/qat/qat_sym_session.c:1194:40: note: (near initializati= on for =E2=80=98digest=E2=80=99) > ninja: build stopped: subcommand failed. > > I think this is because compiler cannot know the size of digest due to fu= nction > 'qat_hash_get_digest_size' during compiling time. Ok, I had not noticed the function call. Please check dynamic allocation succeeds. + free this temp buffer before leaving this helper function. --=20 David marchand