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 76B16A0A0C; Fri, 14 May 2021 10:13:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0059C4013F; Fri, 14 May 2021 10:13:58 +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 C9BD140041 for ; Fri, 14 May 2021 10:13:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620980034; 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=iRymwcAt5GdH9sMg9Xq4L8Q28J1ZsqcLeiyXzMR33dUqQWJwVzwq404JgyKZk8a8YfvNI3 IwYPm8E9xeiz6VUt2m5avec7lVCFUCGo7dSBiXmVitO0bjOzYTWxmiKO8SWMQushks4iHu jeOtAj0tHhzwIvt26do1Mdf1zPGZL64= Received: from mail-ua1-f70.google.com (mail-ua1-f70.google.com [209.85.222.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-G-WG7yiSNl-aC47f4gVeGg-1; Fri, 14 May 2021 04:13:53 -0400 X-MC-Unique: G-WG7yiSNl-aC47f4gVeGg-1 Received: by mail-ua1-f70.google.com with SMTP id r4-20020ab070c40000b02902064b454facso4408697ual.6 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=XuGhlxDeZUILVq9/HQRkVsQeJnTRJGtcJjEfyqQPO3eGVsjIC4Q+I56Mm6EBYaGFu4 546dGqRS5cIqysL+TePrXifUbv/G8ttUlVtJLTnDmiLUzNzxiLnP6PmtY692qOOcCdrB qhaoe9xUGnEzP2pYyTPnAaSLJtNdUGviIoSgAiVy5AbBJ7tkp310r7bPwHo32tUSN+kB QnQtqkCfFlRCufO0eY//GeLPrR94B/MsDgDKL2NROV6ZIK0HzDWNEupXiOpolK6oaIrT TY0Xu+Fqy2VVcq+5L+BvsdDHOYtbwG0kHmcb67Twan5hdNHd8Qnc72R5icq7UWYfc1d9 BeDQ== X-Gm-Message-State: AOAM530S8wcwoal7RtPCDkHHbC+BCc+hM/aRu8x3xW+uPVJD+xc7Ek9I GwDhLVJgPZf+kJ2Yz9NsIJrbETlujdQHhkyRnzkK5DmzMMq+b/KBO5u2YyUchEwmn0ZxGE29JQY D7z4h640bJfraHnCzGrU= X-Received: by 2002:ab0:6497:: with SMTP id p23mr41092175uam.86.1620980032751; 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-dev] [dpdk-stable] [PATCH] crypto/qat: fix uninitilized compiler warning 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 Sender: "dev" 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