From patchwork Sat May 28 09:35:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Schieli?= X-Patchwork-Id: 826042 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4S9ZnbO006970 for ; Sat, 28 May 2011 09:35:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751704Ab1E1Jff (ORCPT ); Sat, 28 May 2011 05:35:35 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:59634 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751413Ab1E1Jff (ORCPT ); Sat, 28 May 2011 05:35:35 -0400 Received: by wya21 with SMTP id 21so1722592wya.19 for ; Sat, 28 May 2011 02:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :mime-version:content-type:content-transfer-encoding; bh=qOvdw6xusa91V0yoJNgKadgwDeKhBkGFosOLPTRjVE4=; b=oxTHOpNRyAfbFLzrlvthLcvZXEXy3S3u/roTfDvW3NE/8CbfsYaOQn2Lc+OkN9pFZl hd5UCZfgW/iCRiItw9wvubms5DN3h1NEaSEQJURvptRLwfT03IgwnZy7tTLeZwunB1MO jwkZQiqE7f+cy0dA1IBv91EpdviSmP0XieaqA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; b=Pa2+e43vrohL95vtYz8/ntWDaAWNjD8F6oIm9licjdfYzSUJFaC29U3aWySwitRRyw gsEh3iWm+3nQUhnn22SNJ1pvAf0waz86Lzh9qBEXlDS47PTxiBCCoe0yILpBSIsQ1ss5 X/qeOU6y6GPQqw7EUv2HTq3d65TQ64FfRD018= Received: by 10.216.255.73 with SMTP id i51mr552171wes.88.1306575334050; Sat, 28 May 2011 02:35:34 -0700 (PDT) Received: from localhost.localdomain (sdrik.gabriello.fr [88.169.81.69]) by mx.google.com with ESMTPS id e1sm1729283wbh.5.2011.05.28.02.35.32 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 28 May 2011 02:35:33 -0700 (PDT) From: =?UTF-8?q?C=C3=A9dric=20Schieli?= To: linux-media@vger.kernel.org Cc: =?UTF-8?q?C=C3=A9dric=20Schieli?= Subject: [PATCH] keytable: fix segfault when RC driver's module_name is null Date: Sat, 28 May 2011 11:35:16 +0200 Message-Id: <1306575316-25536-1-git-send-email-cschieli@gmail.com> X-Mailer: git-send-email 1.7.4.1 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 28 May 2011 09:35:49 +0000 (UTC) Some dvb-usb drivers do not set a proper module_name in their rc.core struct (e.g. the ttusb2 module and various dib0700 submodules as of 2.6.39). Auto-load mode was segfaulting if trying to match those drivers with a * value. Signed-off-by: Cédric Schieli --- utils/keytable/keytable.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index c406a18..13df13b 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1427,9 +1427,9 @@ int main(int argc, char *argv[]) int rc; for (cur = &cfg; cur->next; cur = cur->next) { - if (strcasecmp(cur->driver, rc_dev.drv_name) && strcasecmp(cur->driver, "*")) + if ((!rc_dev.drv_name || strcasecmp(cur->driver, rc_dev.drv_name)) && strcasecmp(cur->driver, "*")) continue; - if (strcasecmp(cur->table, rc_dev.keytable_name) && strcasecmp(cur->table, "*")) + if ((!rc_dev.keytable_name || strcasecmp(cur->table, rc_dev.keytable_name)) && strcasecmp(cur->table, "*")) continue; break; }