Skip to content
Heist/ feed
Back to feed
UnratedFix available

power: supply: core: Fix boundary conditions in interpolation

Type: advisorySources: OSV

In the Linux kernel, the following vulnerability has been resolved: power: supply: core: Fix boundary conditions in interpolation The functions power_supply_temp2resist_simple and power_supply_ocv2cap_simple handle boundary conditions incorrectly. The change was introduced in a4585ba2050f460f749bbaf2b67bd56c41e30283 ("power: supply: core: Use library interpolation"). There are two issues: First, the lines "high = i - 1" and "high = i" in ocv2cap have the wrong order compared to temp2resist. As a consequence, ocv2cap sets high=-1 if ocv>table[0].ocv, which causes an out-of-bounds read. Second, the logic of temp2resist is also not correct. Consider the case table[] = {{20, 100}, {10, 80}, {0, 60}}. For temp=5, we expect a resistance of 70% by interpolation. However, temp2resist sets high=low=2 and returns 60.

Products
Kernel
Affected versions
Not specified
Fixed versions
5.18.13
CVEs
CVE-2022-49612
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 04:19 UTC · Revision 1

Source evidence

power: supply: core: Fix boundary conditions in interpolation

core-osv · Original source

Published 26 Feb 2025, 02:23 UTC

In the Linux kernel, the following vulnerability has been resolved: power: supply: core: Fix boundary conditions in interpolation The functions power_supply_temp2resist_simple and power_supply_ocv2cap_simple handle boundary conditions incorrectly. The change was introduced in a4585ba2050f460f749bbaf2b67bd56c41e30283 ("power: supply: core: Use library interpolation"). There are two issues: First, the lines "high = i - 1" and "high = i" in ocv2cap have the wrong order compared to temp2resist. As a consequence, ocv2cap sets high=-1 if ocv>table[0].ocv, which causes an out-of-bounds read. Second, the logic of temp2resist is also not correct. Consider the case table[] = {{20, 100}, {10, 80}, {0, 60}}. For temp=5, we expect a resistance of 70% by interpolation. However, temp2resist sets high=low=2 and returns 60.

osv:CVE-2022-49612

Kernel

Fixed versions: 5.18.13

Complete source record
{
  "id": "a002d75a586fc1988acc2c25ab58e14ad00ff39463c387146c2f76a80bcf81c2",
  "url": "https://osv.dev/vulnerability/CVE-2022-49612",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "power: supply: core: Fix boundary conditions in interpolation",
    "summary": "In the Linux kernel, the following vulnerability has been resolved: power: supply: core: Fix boundary conditions in interpolation The functions power_supply_temp2resist_simple and power_supply_ocv2cap_simple handle boundary conditions incorrectly. The change was introduced in a4585ba2050f460f749bbaf2b67bd56c41e30283 (\"power: supply: core: Use library interpolation\"). There are two issues: First, the lines \"high = i - 1\" and \"high = i\" in ocv2cap have the wrong order compared to temp2resist. As a consequence, ocv2cap sets high=-1 if ocv>table[0].ocv, which causes an out-of-bounds read. Second, the logic of temp2resist is also not correct. Consider the case table[] = {{20, 100}, {10, 80}, {0, 60}}. For temp=5, we expect a resistance of 70% by interpolation. However, temp2resist sets high=low=2 and returns 60.",
    "evidence": "osv:CVE-2022-49612",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "5.18.13",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "CVE-2022-49612",
      "aliases": [
        "CVE-2022-49612"
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "a4585ba2050f460f749bbaf2b67bd56c41e30283"
                },
                {
                  "fixed": "a762cee5d933fe4e2e1b773d60fc74fb8248d8c4"
                },
                {
                  "fixed": "093d27bb6f2d1963f927ef59c9a2d37059175426"
                }
              ]
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-49612.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "5.17.0"
                },
                {
                  "fixed": "5.18.13"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-49612.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:33.415619190Z",
      "provider": "osv",
      "references": [
        "https://git.kernel.org/stable/c/093d27bb6f2d1963f927ef59c9a2d37059175426",
        "https://git.kernel.org/stable/c/a762cee5d933fe4e2e1b773d60fc74fb8248d8c4",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49612.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-49612",
        "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
      ],
      "provider_metadata": {
        "cna_assigner": "Linux",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49612.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-49612",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 500245,
  "published_at": "2025-02-26T02:23:34.263+00:00"
}