Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2224432lqt; Mon, 22 Apr 2024 05:22:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZEo+w8ESgrVpPz/SZcdSycSwJH05726T+x1WUBKGY4djpYIdeJ0oZm7/ropBLKeYEU5DOUtYPvLPERn6I2QHOd4wjvOkSo5F4tTUSFA== X-Google-Smtp-Source: AGHT+IFziS9lTvI/0+uNIRshC522zTsRHiAhJi1UgEs3wUtK31OImuKFhAkGWlRR74xgl3JgGZ1w X-Received: by 2002:a17:906:4f15:b0:a53:fdc6:3ca7 with SMTP id t21-20020a1709064f1500b00a53fdc63ca7mr6548817eju.26.1713788530185; Mon, 22 Apr 2024 05:22:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713788530; cv=pass; d=google.com; s=arc-20160816; b=MrQB0/VZTZ4moVtu9C93MmD2ujAi1vRtuYHH2R/QwdywHosMmQIp7xe2Y48cPYsxc9 hx+cy1eDAa53Kqo8vYf9jcBwIazfukTe2LK8qv6VwpSumEsSGXyK9Q/vFCUmSHlGAhMR mCiDwOD7toGDIvfntQGgC0QncAm7fM8kXoAlIgOav+9rb7xI4pyrY67jbiVGldkYGhPS svX2Z0M7IpcBoEpjuz54dK1BX+QJdBxKpoze4yXuV7vaCwopiAVOfmHckgGLI0Wcr0Fe piDUX/AE3aYMq3M5b+KAcqTwTdr3vEWJkSob9V0vWzjlpLdMKxRyzqKqgRiz+HVG3UMv wDAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0BlZP+UnOy9RKAtKvK3uY1OvoIWiYaa+dFRGLHz/zdQ=; fh=WKMR4/q0rFT+UH0/khwhAbRtElcsSNfakslB+XjRsew=; b=P+RNZ1y1PQxp7EhUi0EHHrPJIP4anQyi923b94ArsSDWdRu69FSYI8n6q3LpeZGbJn G4Ovk7NoijPyePrHnR/+hHU8UIFchVnI2oM9QSYy6+cYclnVUOzb5efQpSsR7GL8iMiW JEdzu1L4PcdNntW4GlJ92BSQiVIeJCDuLAhLdk0K9TiGQSt/hzCcwpeZgbzcqmj0cXg+ +Ll9X8RxPhxncYeZSYLV0GG6Vx65QMJ8XBxWUpAEC3jYCqEhEiQMqV+tqrL74561vvW4 tNN2ZyNnQhQvAQpsmBJBrRNgYERbZGOwIlIS1Lg9n5ljH/sed5rQDOSfT/QZ5oZYfrMR xovQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Jfx/ls+y"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-153330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ho30-20020a1709070e9e00b00a51e45106fcsi6079050ejc.1037.2024.04.22.05.22.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 05:22:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Jfx/ls+y"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-153330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BCE1C1F21D4D for ; Mon, 22 Apr 2024 12:22:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9303014A4C7; Mon, 22 Apr 2024 12:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Jfx/ls+y" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6D144F213; Mon, 22 Apr 2024 12:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713788504; cv=none; b=E1UmFR/A43fQ6fAJCql0kFI8P3kjZ4MIvhkq0joe9IssBP2qqX6LgbYcJsgUpPP8YA0FCGi8W1h58fc6+xDFYNRDvxe/dW6pnvdUt9SSwCiOS8Q0j3qxQ6aL2lvv5gmUTgnyQH4ksGjyKm3MoB9sTax69pDCMtbudGn2NUbOi70= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713788504; c=relaxed/simple; bh=UTkmHZeikRa1ycDagwCQkNkwCuglgm4WeonLx4GtOEw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RMakXbhXmR6/C6i0m33BEFadx4cABu2H6ZccsdvrFupNHCtCbtJKLmcOKNaV9NYKBWol0NV9Vg2VLD8PQOtBW6/J8TExhxWBDntbJ8wsuFEOrlFdGMe9koAziKUXrjbccQME8kbrz+TNrgw7GBK0enSKNetFVNMgIs0Pvo2/NHg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Jfx/ls+y; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713788503; x=1745324503; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=UTkmHZeikRa1ycDagwCQkNkwCuglgm4WeonLx4GtOEw=; b=Jfx/ls+yJ2UQi0omg79le6KC2X9BDAKSak/DvZiyPFV0fON07NwNKj/g qgmV0SKNNr6LTO6mOI4teVkEE04hYedBQRJ7Nahgc1bd3zbm329NFDaYB Pc7GoZYpCQ4ZMa9biHSZFyMt5K4mbS3IAnKRDAjJLHszq2cDA9sk/RFZk VDrkuXIpiSI1luCgYd3MioDhPKeHtaWUeq/CTbvLSI6PeLcrF9FS+2LvF vVl39aieq4bywS2NjsXvwK4g7Vo09LvQNFiveU6rR6IKLQ4pocSVRxsq9 CisZdPlTySxnUdJvX9iiMLX9i4YQtm1P0ddAxOOoVVFvliwCh92HdxBte w==; X-CSE-ConnectionGUID: YkHlFWveSNK4dmVhYMPSlg== X-CSE-MsgGUID: E1F9jT/GRECMjEjZfFimPw== X-IronPort-AV: E=McAfee;i="6600,9927,11051"; a="13110017" X-IronPort-AV: E=Sophos;i="6.07,220,1708416000"; d="scan'208";a="13110017" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2024 05:21:42 -0700 X-CSE-ConnectionGUID: M3MyFjZSToWhCUpBOEqfEw== X-CSE-MsgGUID: 54UoqB0yTdG9DYu9uyRjRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,220,1708416000"; d="scan'208";a="61448676" Received: from lkp-server01.sh.intel.com (HELO 69a5ba6c3aa8) ([10.239.97.150]) by orviesa001.jf.intel.com with ESMTP; 22 Apr 2024 05:21:39 -0700 Received: from kbuild by 69a5ba6c3aa8 with local (Exim 4.96) (envelope-from ) id 1rysfw-00002m-1H; Mon, 22 Apr 2024 12:21:36 +0000 Date: Mon, 22 Apr 2024 20:20:38 +0800 From: kernel test robot To: Maxime MERE , Herbert Xu , "David S . Miller" , Maxime Coquelin , Alexandre Torgue Cc: oe-kbuild-all@lists.linux.dev, Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Rob Herring , linux-crypto@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] crypto: stm32/cryp - use dma when possible. Message-ID: <202404222021.S9hjJBpb-lkp@intel.com> References: <20240418144256.3736800-2-maxime.mere@foss.st.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240418144256.3736800-2-maxime.mere@foss.st.com> Hi Maxime, kernel test robot noticed the following build warnings: [auto build test WARNING on atorgue-stm32/stm32-next] [also build test WARNING on herbert-crypto-2.6/master herbert-cryptodev-2.6/master linus/master v6.9-rc5 next-20240422] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Maxime-MERE/crypto-stm32-cryp-use-dma-when-possible/20240418-224748 base: https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git stm32-next patch link: https://lore.kernel.org/r/20240418144256.3736800-2-maxime.mere%40foss.st.com patch subject: [PATCH 1/3] crypto: stm32/cryp - use dma when possible. config: arm-randconfig-r081-20240422 (https://download.01.org/0day-ci/archive/20240422/202404222021.S9hjJBpb-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202404222021.S9hjJBpb-lkp@intel.com/ smatch warnings: drivers/crypto/stm32/stm32-cryp.c:1496 stm32_cryp_truncate_sg() warn: unsigned 'alloc_sg_len' is never less than zero. drivers/crypto/stm32/stm32-cryp.c:1580 stm32_cryp_cipher_prepare() warn: unsigned 'cryp->in_sg_len' is never less than zero. drivers/crypto/stm32/stm32-cryp.c:1584 stm32_cryp_cipher_prepare() warn: unsigned 'cryp->out_sg_len' is never less than zero. vim +/alloc_sg_len +1496 drivers/crypto/stm32/stm32-cryp.c 1481 1482 static int stm32_cryp_truncate_sg(struct scatterlist **new_sg, size_t *new_sg_len, 1483 struct scatterlist *sg, off_t skip, size_t size) 1484 { 1485 struct scatterlist *cur; 1486 size_t alloc_sg_len; 1487 1488 *new_sg_len = 0; 1489 1490 if (!sg || !size) { 1491 *new_sg = NULL; 1492 return 0; 1493 } 1494 1495 alloc_sg_len = sg_nents_for_len(sg, skip + size); > 1496 if (alloc_sg_len < 0) 1497 return alloc_sg_len; 1498 1499 /* We allocate to much sg entry, but it is easier */ 1500 *new_sg = kmalloc_array(alloc_sg_len, sizeof(struct scatterlist), GFP_KERNEL); 1501 if (!*new_sg) 1502 return -ENOMEM; 1503 1504 sg_init_table(*new_sg, alloc_sg_len); 1505 1506 cur = *new_sg; 1507 while (sg && size) { 1508 unsigned int len = sg->length; 1509 unsigned int offset = sg->offset; 1510 1511 if (skip > len) { 1512 skip -= len; 1513 sg = sg_next(sg); 1514 continue; 1515 } 1516 1517 if (skip) { 1518 len -= skip; 1519 offset += skip; 1520 skip = 0; 1521 } 1522 1523 if (size < len) 1524 len = size; 1525 1526 if (len > 0) { 1527 (*new_sg_len)++; 1528 size -= len; 1529 sg_set_page(cur, sg_page(sg), len, offset); 1530 if (size == 0) 1531 sg_mark_end(cur); 1532 cur = sg_next(cur); 1533 } 1534 1535 sg = sg_next(sg); 1536 } 1537 1538 return 0; 1539 } 1540 1541 static int stm32_cryp_cipher_prepare(struct stm32_cryp *cryp, struct scatterlist *in_sg, 1542 struct scatterlist *out_sg) 1543 { 1544 size_t align_size; 1545 1546 cryp->dma_mode = stm32_cryp_dma_check(cryp, in_sg, out_sg); 1547 1548 scatterwalk_start(&cryp->in_walk, in_sg); 1549 scatterwalk_start(&cryp->out_walk, out_sg); 1550 1551 if (cryp->dma_mode == NO_DMA) { 1552 cryp->flags &= ~FLG_IN_OUT_DMA; 1553 1554 if (is_ctr(cryp)) 1555 memset(cryp->last_ctr, 0, sizeof(cryp->last_ctr)); 1556 1557 } else if (cryp->dma_mode == DMA_NEED_SG_TRUNC) { 1558 int ret; 1559 1560 cryp->flags |= FLG_IN_OUT_DMA; 1561 1562 align_size = ALIGN_DOWN(cryp->payload_in, cryp->hw_blocksize); 1563 ret = stm32_cryp_truncate_sg(&cryp->in_sg, &cryp->in_sg_len, in_sg, 0, align_size); 1564 if (ret) 1565 return ret; 1566 1567 ret = stm32_cryp_truncate_sg(&cryp->out_sg, &cryp->out_sg_len, out_sg, 0, 1568 align_size); 1569 if (ret) { 1570 kfree(cryp->in_sg); 1571 return ret; 1572 } 1573 } else { 1574 cryp->flags |= FLG_IN_OUT_DMA; 1575 1576 cryp->in_sg = in_sg; 1577 cryp->out_sg = out_sg; 1578 1579 cryp->in_sg_len = sg_nents_for_len(cryp->in_sg, cryp->payload_in); > 1580 if (cryp->in_sg_len < 0) 1581 return cryp->in_sg_len; 1582 1583 cryp->out_sg_len = sg_nents_for_len(out_sg, cryp->payload_out); > 1584 if (cryp->out_sg_len < 0) 1585 return cryp->out_sg_len; 1586 } 1587 1588 return 0; 1589 } 1590 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki