From patchwork Wed Jul 21 14:01:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 483953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE0CBC12002 for ; Wed, 21 Jul 2021 14:02:45 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9DB1760FED for ; Wed, 21 Jul 2021 14:02:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DB1760FED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A456716CA; Wed, 21 Jul 2021 16:01:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A456716CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626876162; bh=CV8pCxyyRgVxn/fVy1Dc9o53fMDAzKgAZJ60AZJkTAA=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=ZmcX9bdU15moyaKf6dyqXIbv7iRjEwCthJcYZ/p8b0vLrn9Rla22nkU+dvHfFRj+S et5DRHtcWBpybX+oecAJ7o0zU8xC1rV2CQ6W/q3lmOHLbYCsw/pdSJZqqlwd6GPVwc +20tpIKtro5vBgz9IHbVitEY+umoKWjle08K4GeA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 41A64F804AB; Wed, 21 Jul 2021 16:01:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6270DF804AC; Wed, 21 Jul 2021 16:01:50 +0200 (CEST) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8DC1AF800FD for ; Wed, 21 Jul 2021 16:01:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8DC1AF800FD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="WR5fU6Gg"; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="CkpLazG4"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="tJ/6UPBJ" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16LDsur8021888; Wed, 21 Jul 2021 14:01:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2021-07-09; bh=OWOJt2xbBi3McVhHZVgBGE1bXzGJXlXqiRqLa9R6MVQ=; b=WR5fU6GgoG7ZKehbegyJB4zaiaMo4MQNNhhqEFMTFr0RxRMkfIgd9LoQH4EdcrTJDjJL LUZUkRlRaEg7X9mooN6w/8rgy2JqyEkdOgXnClYpVrtMSGMfvk+6Pgl765SgDuhGuOL8 1p7MuMDuvkWuB9m/NdVq3WJ2lq/0leLlB3daEli4krS2JFib1iHUG6Io7OXSZE7NWS2E CLe6pNGK/4CW42ryfV+BoM7SPrgtMWJVJA8JuBmLuDbasBCDZ8S8Cl00ZhASTGmZeHSS fLOG5MAt1EsL8eeC5II11+G3+plw0HdSm9HZfiYGuwofQ0C376KBH9Xx+09r9HvdqZU9 2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2020-01-29; bh=OWOJt2xbBi3McVhHZVgBGE1bXzGJXlXqiRqLa9R6MVQ=; b=CkpLazG4HS8o3ajvs3vsEPYSnON8uP0Ikp+TRBVp6YXtC7ZxCE4PvMMOwj+YDu+35bxL b0yD+pDiHdyhIdsUFUSqgNo35SKSbbg5/tFmbIXTa2lsdx0MmT1OImUSJ6P1ci6rEQeh ynx+DfY49vvehUWuKBAiwzmCwVMBqKqJ50M/0tql60eKNEUijx89E+G/dDJTmGnrDqa8 VkeUB1mz4uwQBDcLoAYboUXE6mI2NU1jqiptyPieYuT6zz+kMvtYKrs2Vcs76QsqE5Ne ggMW8kWoPdjVbpeVLs5FBH/GhiopMdx99Oe2+erCj1fVqhMS75S5mdndae6w+NgpXrHp Lg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 39wvr8axmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Jul 2021 14:01:35 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 16LDtB9O103444; Wed, 21 Jul 2021 14:01:34 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by aserp3020.oracle.com with ESMTP id 39uq198nu6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Jul 2021 14:01:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bl/H3DEADWgI+qLxljZ0ftmuPp2XR7SfRzmOYV6clAP7qGDrgMKpXPfvlHkGhmj5SPp23MVkezexotO4NfYgEQxrAs8+qoZpOlUpI524RfSCW9ZXpniuNc5bT42zxlRtHw+vmrkIrpplfPobhkZ6EVhVHJ+vdIrkZuV/kDZneQlJnYo7k3Qdsd1sQiLdstZROwJyj/PtrFqzbwASRYeDbbbb/7AWApyy215ZJ7o+H63TsT14u5Juh93gfgTxg+IAtijCtvf/xZd/ZSxGQpW7KX1Bt2B8kQfD92neSI/JtKaO/6ROFPuWg9nLr2BCzDh5eQMGvY8BDQpBXybLm2aJoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OWOJt2xbBi3McVhHZVgBGE1bXzGJXlXqiRqLa9R6MVQ=; b=JqHWOMHQB6yGkOehuQZaZvvqgCVo9+5jEn82TXwsB05pHZ/3FjnPWu6YxxH7q/cVttP+tJDmXaW9+oy99gYC8GBawswDUbnaQzWtVKg2JgZb/dlU1NIJK8xVrKkWVrUQPvM7faRB4rRVY29/OpghgNNpL8eqoj7uDILbiatlzxZahbzoBpFuTTDV75cXzIIdcbk2Z7P/i1tYIe08go+5gq65lh1s/a6MYoTyQNy3o35wO0lMYCjeye5wpVGCR6KD5YPDYcQb/8yl7yhy1yUlNi078VoL6PPSdRpdlNdFUD+lOwKeniI01i+UpY09IiOcEBNa26QlN3rcxNeLtZH27w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OWOJt2xbBi3McVhHZVgBGE1bXzGJXlXqiRqLa9R6MVQ=; b=tJ/6UPBJNdYXjp8xHz4ChvgSa8AoGb0xk4WxYOvjfylFJ7TI6UJaljvsqJQw0P0cpPhuY0tNhmsPoPVueBFrPmevI8JpSn3PgjjWqlPZubzuvffUQ+vm6eA8029/aJ2X4wmuMlJhks5Lz7O6TPKDompNS5HDbJCXwkJ8ADCgvFA= Authentication-Results: perex.cz; dkim=none (message not signed) header.d=none; perex.cz; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by MWHPR1001MB2205.namprd10.prod.outlook.com (2603:10b6:301:2d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Wed, 21 Jul 2021 14:01:32 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5820:e42b:73d7:4268]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5820:e42b:73d7:4268%7]) with mapi id 15.20.4331.034; Wed, 21 Jul 2021 14:01:32 +0000 Date: Wed, 21 Jul 2021 17:01:22 +0300 From: Dan Carpenter To: Jaroslav Kysela Subject: [PATCH] ALSA: korg1212: Fix crash in snd_korg1212_create() Message-ID: <20210721140122.GA5251@kili> Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: LO2P265CA0174.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::18) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kili (2a02:6900:8208:1848::11d1) by LO2P265CA0174.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Wed, 21 Jul 2021 14:01:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ef6655f-4f86-4b2b-dab2-08d94c500b90 X-MS-TrafficTypeDiagnostic: MWHPR1001MB2205: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x7C1CeiTuPjQMsSQMP0mZVNYyze9ZPDh8u7Bguvgmbk25o+SBoNyht9MtAlm8LvlRqZLVmcPXinPW88geL93azFEbzwU2tQHymoqNyp1fEp8ByaSfa0z8wzY9JFU4TyCCkOVcpm69GajNf+kJM2RIj0B2ki41hMwD/RbueGMJ9B8N+8HzntwJCAT8fnLNwa7F1mJZOMcUALi79eZEfHv5LlRKKgmDo6zt+BMg6jQ5i5oCIYgAECCLnqi1jF3/sLXiROUIYrhCC3T33pO1CfB97VbsdmBy7OhHLjLbF7rx56ME1OQ3CZT3s1GMUoC50K1AWxbLhCQYkztQP/d8bdTN59WHBBhuNDmVpdba6nfbIo7Nn708Op6HCTTVhZLKBN0xIt3/w7uBKcovtQePInSxpQZ3CFn4UK6S2pWEUSoWekxx63NvKpUJeK8DT5ZFWSomB00zeO11J6BJpa5/E3RDuDLh62sd+tEoJ8Sa9DP6bkBHpt8wvuQqNz+r9odga52bMN37wg4cnO/d8i3Cu/SmEKN7vx1aEBevNNi2xNqf+jQhhiMtPQwtUG3aFdHYLfaF5ja9q9avL52RWXObmLbi+oTEWPl0HlseTgf6nNDFNj5Y221HBC8+U5FI4uFZKG8h7Dae/C/1IdA5pel3dwCyA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(8936002)(33656002)(8676002)(186003)(316002)(86362001)(5660300002)(54906003)(44832011)(52116002)(2906002)(38100700002)(83380400001)(9576002)(66556008)(33716001)(66946007)(4326008)(55016002)(66476007)(6916009)(1076003)(6666004)(508600001)(6496006)(9686003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hmO/yAjAWeA0ZflkX3SJuzIeA7Yt1unW+qoA5tghG81N8EKTZP15fVqPrZqJ9cGo8z9/RLxVLvjnqK+GmrqDhDoIprOakKN0BmqGWcUtteRqAiqEiRgsjJU7Z5DTMnsEijht8A2i3RI4LGHpcoRNbsB7pkbxZi6022hsCin3uxjCI1s/4RCDihUIKKV4OwtJlcC+Hyi4KXSVQz/L0NKgmht+CAcyPMKykPO5eKyrXDBqXJuu0k+j1qoEbfvCOFrIs1wAUisRgklxqvjMsJ8Xrv5XoD2bmxLDLP+p6WgP+jNtKw7i8DwNTAtCxvrUrj1XyvOwQzHt7i+QEQs00+7QgZLxai5gYgfH9rd91mJCM9SZ30OB+gWsW9brv7g6Fioo8LFKnVaTuWq28NKjkuFukDzCgAOyaRa+nmu5Ljw6bWoTw3DPWSsrSa8O1uqPfTiWTjOYtzYOXEqgZzyY8YJQJNydPteN4grmA+W0V8PT23V1YJMs8O1RHZRY/U+jHNRvw2W44zE8BqLYr39ntuJU3KH/AQuUqS11+Nw8yazYTTt7F8ICJ5LefOQRpEBlIYOvF5x8V2d69qOFS9n8jYtwwSkRHzBb+qyP9DehCjQ+3MweP+1D2ZzVpJVvOf+eAoHOUOuGpg57Tao5py7mYDJITTqNXotsF8RtMTrGzVK+99/SYjuO3NpSGxDSoKPtX85jfkCg84qTOLtS91lKNOJ2Rc6bsEKGGuZ1AKAomAjc8tBks9VQ9uWA0J9IjOlYdNFPuVKOq3o9FRmV/s2OH8eJ4AMff0icenC+jytN8qaw6SCEv08LyVSl+288of7X/5SVvtWZr8GmTQ3s9yeKL6d2StOZ8HHzxTScHH6QkmSy04ezwZuvb5lW3U0jAhfNDB7ykwHbdlq84guKPmwYVSxwAYdO4oxjEWy06e0peYRQoyi0+rzJUZca1psT2kIHcOx633cJFz4l7lSbPBfVzQmKPN5upxrd5WfvptPEgGoKAJlE2uvfBBFXRwUzn3ou+RSY+UDrYvY6kyG2vEUeLpxDx+J/c2P35++FOrfHIuj8FLRMfaog5Y/qFaFULyHJSGuk2ewdQUf2Y3FF7oLG7K8PQ5rqpghxMMwlBvtoCdF//Q/qDBzoJ0x5jPaMVgpvgHC3QVWHescXW6tm8RwJNmvVdUaZj9mOWsWzhGm3FbLsnrSUpEClYffCQFUm9irOC1O2hx3Kdu0tstfI6yj/aJ14gun9z1plOM3qj3QEO+0sp1qMBlGIubv1Ymjuw+D+hzrJQph46XF3iuFZoz3ik+zuBgC9DjnzP29p23S0pdym5s6I5d8gSdrQ+SPyXUbehxgHwka2zNevmhHSadijXsf88jJFwBs1COPQoAdkVjG5las= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ef6655f-4f86-4b2b-dab2-08d94c500b90 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 14:01:32.5802 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Yc9rg3gyj9R0bZw/3RhiKgrQ/jCBKArbWMdm8O0OMNJBeM74f1ogxo7rDcqz71jISswTwmwPlcBSDU3Gs6Yok04DPGzIwR6EYw+UjpX5sV0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2205 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10052 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107210081 X-Proofpoint-GUID: BP7mV8y3ldkQAnrGx5ggHHoKmTvChqCK X-Proofpoint-ORIG-GUID: BP7mV8y3ldkQAnrGx5ggHHoKmTvChqCK Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, Takashi Iwai , Leon Romanovsky X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The "dsp_code" is not initialized until the next line so we can't dereference it. Fixes: b5cde369b618 ("ALSA: korg1212: Allocate resources with device-managed APIs") Signed-off-by: Dan Carpenter --- sound/pci/korg1212/korg1212.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 7872abbd4587..3b2df5d06839 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -2256,17 +2256,17 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci) korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy + offsetof(struct KorgSharedBuffer, AdatTimeCode); - korg1212->dma_dsp = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV, - dsp_code->size); - if (!korg1212->dma_dsp) - return -ENOMEM; - err = request_firmware(&dsp_code, "korg/k1212.dsp", &pci->dev); if (err < 0) { snd_printk(KERN_ERR "firmware not available\n"); return err; } + korg1212->dma_dsp = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV, + dsp_code->size); + if (!korg1212->dma_dsp) + return -ENOMEM; + K1212_DEBUG_PRINTK("K1212_DEBUG: DSP Code area = 0x%p (0x%08x) %d bytes [%s]\n", korg1212->dma_dsp->area, korg1212->dma_dsp->addr, dsp_code->size, stateName[korg1212->cardState]);