---
name: "kstrdup_const"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/kstrdup_const"
---

# kstrdup\_const(9)

conditionally duplicate an existing const string

## NAME

kstrdup\_const - conditionally duplicate an existing const string

## SYNOPSIS

**const char \* kstrdup\_const(const char \*** *s***, gfp\_t** *gfp***);**

## ARGUMENTS

*s*

the string to duplicate

*gfp*

the GFP mask used in the **kmalloc** call when allocating memory

## DESCRIPTION

Function returns source string if it is in .rodata section otherwise it fallbacks to kstrdup. Strings allocated by kstrdup\_const should be freed by kfree\_const.

## COPYRIGHT
